Skip to content

Instantly share code, notes, and snippets.

@ishwarrimal
Last active August 24, 2020 10:39
Show Gist options
  • Save ishwarrimal/0e65f9db3e89ff8a444e303981cf926e to your computer and use it in GitHub Desktop.
Save ishwarrimal/0e65f9db3e89ff8a444e303981cf926e to your computer and use it in GitHub Desktop.
A simple JS implementaiton of debounce
let setTimer = null
let debounce = (cb, delay) => {
clearTimeout(setTimer)
setTimer = setTimeout(cb, delay);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment