SHARE
TWEET

Untitled

a guest Mar 20th, 2017 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function limiter(fn, wait) {
  2.     let isCalled = false;
  3.  
  4.     return function() {
  5.         if (!isCalled) {
  6.             fn();
  7.             isCalled = true;
  8.             setTimeout(function() {
  9.                 isCalled = false;
  10.             }, wait)
  11.         }
  12.     };
  13. }
RAW Paste Data
Top