Created
December 13, 2018 09:28
-
-
Save OlivierJM/1345c32e24b655d9333436b834bc6d7b 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