all files / main/lib/ debounce.js

37.5% Statements 3/8
100% Branches 0/0
50% Functions 1/2
37.5% Lines 3/8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18                             
"use strict";
 
Object.defineProperty(exports, "__esModule", {
  value: true
});
 
exports.default = function (fn, ms) {
  return function () {
    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
 
    clearTimeout(fn.timeout);
    fn.timeout = setTimeout(fn.bind.apply(fn, [undefined].concat(args)), ms);
    return fn.timeout;
  };
};