Skip to content

Instantly share code, notes, and snippets.

@alepez
Created February 27, 2015 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alepez/f1067c6569ab48fbb4c0 to your computer and use it in GitHub Desktop.
Save alepez/f1067c6569ab48fbb4c0 to your computer and use it in GitHub Desktop.
makeLazy
var makeLazy = function (fn, delay) {
var timeHandler;
return function () {
clearTimeout(timeHandler);
timeHandler = setTimeout(fn.bind.apply(fn, [null].concat(Array.prototype.slice.call(arguments))), delay);
};
};
@alepez
Copy link
Author

alepez commented Feb 27, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment