Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function throttle(fn, delay) {
- var canInvoke = true;
- var invokeDelay = function () {
- canInvoke = true;
- };
- return function () {
- if (canInvoke) {
- fn.apply(this, arguments);
- canInvoke = false;
- setTimeout(invokeDelay, delay);
- }
- };
- }
Add Comment
Please, Sign In to add comment