init
This commit is contained in:
commit
44f31f8b9f
402 changed files with 47865 additions and 0 deletions
17
utils/debounce.js
Normal file
17
utils/debounce.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
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)
|
Loading…
Add table
Add a link
Reference in a new issue