debounce
unknown
javascript
4 years ago
267 B
5
Indexable
const debounce = (callback, delay = 1000) => { let timeoutId; return (...arg) => { if (timeoutId) { clearTimeout(timeoutId) } timeoutId = setTimeout(() => { callback.apply(null, arg); }, delay); } }
Editor is loading...