doc.yeswiki.pro/node_modules/@algolia/autocomplete-shared/dist/esm/debounce.js

16 lines
376 B
JavaScript
Raw Normal View History

2023-05-20 16:37:42 +00:00
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);
};
}