Skip to content

Instantly share code, notes, and snippets.

@sharmaabhinav
Created November 6, 2017 07:32
Show Gist options
  • Save sharmaabhinav/09e3c2a833043b7e74b4f33bd467e5ab to your computer and use it in GitHub Desktop.
Save sharmaabhinav/09e3c2a833043b7e74b4f33bd467e5ab to your computer and use it in GitHub Desktop.
function debounce(fn, delay) {
var timer = null
return function () {
var args = arguments
clearTimeout(timer)
timer = setTimeout(function () {
fn.apply(null, args)
}, delay)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment