Sha256: 9f63f267c5896275c0655a0031d54e6d542b3247453ba0164dcbfa15c0f57e30

Contents?: true

Size: 684 Bytes

Versions: 3

Compression:

Stored size: 684 Bytes

Contents

(function() {
  window.throttle = function(func, wait) {
    var args, result, thisArg, timeoutId, lastCalled = 0;

    function trailingCall() {
      lastCalled = new Date;
      timeoutId = null;
      result = func.apply(thisArg, args);
    }
    return function() {
      var now = new Date,
        remaining = wait - (now - lastCalled);

      args = arguments;
      thisArg = this;

      if (remaining <= 0) {
        clearTimeout(timeoutId);
        timeoutId = null;
        lastCalled = now;
        result = func.apply(thisArg, args);
      } else if (!timeoutId) {
        timeoutId = setTimeout(trailingCall, remaining);
      }
      return result;
    };
  };
})();

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
jekyll-text-theme-fork-2.2.6 _includes/scripts/lib/throttle.js
jekyll-text-theme-2.2.6 _includes/scripts/lib/throttle.js
jekyll-text-theme-2.2.5 _includes/scripts/lib/throttle.js