b32527e057
This reverts commit 7f8f7c2aa15c8b8c6a7449d177f46f8a417e2f67.
18 lines
361 B
JavaScript
18 lines
361 B
JavaScript
export const _debounce = (func, waitFor) => {
|
|
let timeout = null
|
|
|
|
const debounceFunction = (...args) => {
|
|
if (timeout) {
|
|
clearTimeout(timeout)
|
|
timeout = null
|
|
}
|
|
timeout = setTimeout(() => {
|
|
return func(...args)
|
|
}, waitFor)
|
|
}
|
|
|
|
return debounceFunction
|
|
}
|
|
|
|
export const debounce = _debounce((func, args) => func(args), 400)
|