Skip to content

Instantly share code, notes, and snippets.

@killerbytes
Created July 5, 2012 02:14
Show Gist options
  • Save killerbytes/3050623 to your computer and use it in GitHub Desktop.
Save killerbytes/3050623 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