Skip to content

Instantly share code, notes, and snippets.

@derek-watson
Created August 14, 2012 14:44
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derek-watson/3349917 to your computer and use it in GitHub Desktop.
Save derek-watson/3349917 to your computer and use it in GitHub Desktop.
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