Created
December 13, 2018 09:28
-
-
Save OlivierJM/1c73d8ef0d62d6e983e68838881e5302 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const debounce = (func, delay) => { | |
let inDebounce | |
return function(...args){ // curry the the other arguments | |
// const args = argumets | |
const context = this | |
clearTimeout(inDebounce) | |
inDebounce = setTimeout(() => func.apply(context, args), delay) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment