Skip to content

Instantly share code, notes, and snippets.

@jstrellner
Created April 23, 2016 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jstrellner/3c2f504af223d4f11bcc1e64095fe141 to your computer and use it in GitHub Desktop.
Save jstrellner/3c2f504af223d4f11bcc1e64095fe141 to your computer and use it in GitHub Desktop.
// debounce function
//
// call like:
// debouncer(function() {
// console.log('do stuff');
// }, 1000);
function debouncer(c,to,t){
debouncer=function(c){
clearTimeout(t);
t=setTimeout(c,to);
};
debouncer(c);
return c;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment