Skip to content

Instantly share code, notes, and snippets.

@derek-watson
Created August 14, 2012 14:44
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Simple javascript function throttling
var isThrottled = false,
throttleDuration = 24; // ms
function thingToThrottle() {
if (isThrottled) { return; }
isThrottled = true;
setTimeout(function () { isThrottled = false; }, throttleDuration);
// do your work here
}
@abdelshok
Copy link

That's the kind of throttling I'm talking about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment