doc.yeswiki.pro/node_modules/@algolia/autocomplete-shared/dist/esm/debounce.js
2023-05-20 19:38:02 +03:00

16 lines
No EOL
376 B
JavaScript

export function debounce(fn, time) {
var timerId = undefined;
return function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (timerId) {
clearTimeout(timerId);
}
timerId = setTimeout(function () {
return fn.apply(void 0, args);
}, time);
};
}