daily pastebin goal
72%
SHARE
TWEET

Untitled

a guest Jan 21st, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function throttle(fn, delay) {
  2.     var canInvoke = true;
  3.     var invokeDelay = function () {
  4.         canInvoke = true;
  5.     };
  6.  
  7.     return function () {
  8.         if (canInvoke) {
  9.             fn.apply(this, arguments);
  10.             canInvoke = false;
  11.             setTimeout(invokeDelay, delay);
  12.         }
  13.     };
  14. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top