Skip to content

Instantly share code, notes, and snippets.

@derek-watson
Created August 14, 2012 14:44
Show Gist options
  • Select an option

  • Save derek-watson/3349917 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown

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