vuestic-ui
Version:
Vue 3 UI Framework
20 lines (19 loc) • 399 B
JavaScript
const debounce = (func, wait) => {
let timeout = null;
const fn = function(...args) {
timeout && clearTimeout(timeout);
timeout = setTimeout(() => {
timeout = null;
func.apply(this, args);
}, wait);
};
fn.cancel = () => {
timeout && clearTimeout(timeout);
timeout = null;
};
return fn;
};
export {
debounce as d
};
//# sourceMappingURL=debounce.mjs.map