Skip to content

Instantly share code, notes, and snippets.

@zloyrusskiy
Created June 16, 2014 13:33
Show Gist options
  • Save zloyrusskiy/b709dcb4601a8823f20f to your computer and use it in GitHub Desktop.
Save zloyrusskiy/b709dcb4601a8823f20f to your computer and use it in GitHub Desktop.
bufferedDelay JS function
bufferedDelay = (function () {
var delays = {};
return function (alias, delay, callback) {
if (delays[alias]) {
clearTimeout(delays[alias]);
}
delays[alias] = setTimeout(function () { delete delays[alias]; callback(); }, delay);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment