Skip to content

Instantly share code, notes, and snippets.

@OlivierJM
Created December 13, 2018 09:28
Show Gist options
  • Save OlivierJM/1345c32e24b655d9333436b834bc6d7b to your computer and use it in GitHub Desktop.
Save OlivierJM/1345c32e24b655d9333436b834bc6d7b to your computer and use it in GitHub Desktop.
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