Skip to content

Instantly share code, notes, and snippets.

@ralphcrisostomo
Forked from killerbytes/gist:3050623
Created July 11, 2012 08:15
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 ralphcrisostomo/3088892 to your computer and use it in GitHub Desktop.
Save ralphcrisostomo/3088892 to your computer and use it in GitHub Desktop.
Javascript: delay
var delay = (function() {
var timer = 0;
return function(callback, ms) {
clearTimeout(timer);
timer = setTimeout(callback, ms);
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment