"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.preventEventDoubling = void 0;
var preventEventDoubling = exports.preventEventDoubling = function preventEventDoubling(eventHandler) {
  var minTimeDiff = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;
  var lastClickTime;
  return function () {
    var thisClickTime = new Date().getTime();
    if (lastClickTime && thisClickTime - lastClickTime < minTimeDiff) {
      return;
    }
    lastClickTime = thisClickTime;
    return eventHandler.apply(void 0, arguments);
  };
};