Instantly share code, notes, and snippets.

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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment