UNPKG

@bigmi/client

Version:

Reactive primitives for Bitcoin apps.

22 lines (21 loc) 444 B
//#region src/utils/debounce.ts function debounce(fn, delay) { let timeoutId; const debounced = ((...args) => { if (timeoutId) clearTimeout(timeoutId); timeoutId = setTimeout(() => { fn(...args); timeoutId = void 0; }, delay); }); debounced.cancel = () => { if (timeoutId) { clearTimeout(timeoutId); timeoutId = void 0; } }; return debounced; } //#endregion export { debounce }; //# sourceMappingURL=debounce.js.map