Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Throttle helps to save performance, because it reduces number of calls
// It can be used to save input values after change
// $('input').on('change', throttle(function(){
// $.ajax(url);
//}, 1000))
function throttle(fn, time) {
return function inner() {
var args =;
inner.timeout = setTimeout(function () {
fn.apply(null, args);
}, time);
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.