1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | function debounce(duration, fn) {
|
4 | var timeout;
|
5 | return function () {
|
6 | var _this = this;
|
7 | var args = [];
|
8 | for (var _i = 0; _i < arguments.length; _i++) {
|
9 | args[_i] = arguments[_i];
|
10 | }
|
11 | if (timeout) {
|
12 | window.clearTimeout(timeout);
|
13 | }
|
14 | timeout = window.setTimeout(function () {
|
15 | timeout = null;
|
16 | fn.apply(_this, args);
|
17 | }, duration);
|
18 | };
|
19 | }
|
20 | exports.default = debounce;
|
21 |
|
\ | No newline at end of file |