Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function throttle(f, delay){
var timer = null;
return function(){
var context = this, args = arguments;
clearTimeout(timer);
timer = window.setTimeout(function(){
f.apply(context, args);
},
delay || 500);
};
}
@shanejones

This comment has been minimized.

Copy link
Owner Author

shanejones commented Aug 4, 2017

Use in functions like keyup to throttle the rest of the function from runniing

.keyup( throttle( function() { /* your function here */ })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.