decentraland-ui
Version:
Decentraland's UI components and styles
27 lines (26 loc) • 905 B
JavaScript
;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createDebounce = void 0;
function createDebounce() {
var timeout = null;
return function (fn, ms) {
var args = [];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
if (timeout) {
clearTimeout(timeout);
}
timeout = setTimeout.apply(void 0, __spreadArray([fn, ms], args, false));
};
}
exports.createDebounce = createDebounce;