Skip to content

Instantly share code, notes, and snippets.

@kerotaa
Created September 13, 2013 06:51
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 kerotaa/6547416 to your computer and use it in GitHub Desktop.
Save kerotaa/6547416 to your computer and use it in GitHub Desktop.
easy throttle
function throttle(fn, interval) {
var timer = null;
return function() {
var self = this, args = arguments;
if (!timer) {
timer = setTimeout(function() {
timer = null;
fn.apply(self, args);
}, interval);
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment