pubo-utils 1.0.129 → 1.0.142
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pubo-utils.js +1 -1
- package/es/color/utils.js +21 -19
- package/es/debounce/index.js +16 -52
- package/es/emitter/index.js +217 -229
- package/es/factory/index.js +3 -32
- package/es/filter/sensor.js +58 -65
- package/es/level/index.js +6 -4
- package/es/loop/index.d.ts +1 -1
- package/es/loop/index.js +92 -163
- package/es/math/geometry.js +28 -107
- package/es/promise/index.js +9 -41
- package/es/queue/index.js +97 -174
- package/es/random/index.js +1 -32
- package/es/regexp-list/index.js +6 -5
- package/es/sleep/index.js +23 -128
- package/es/stack/index.js +20 -17
- package/es/throttle/index.js +1 -36
- package/es/trigger/index.js +17 -12
- package/es/watch-dog/index.js +12 -10
- package/lib/color/utils.js +20 -17
- package/lib/debounce/index.js +16 -52
- package/lib/emitter/index.js +216 -226
- package/lib/factory/index.js +3 -32
- package/lib/filter/sensor.js +57 -62
- package/lib/level/index.js +5 -2
- package/lib/loop/index.d.ts +1 -1
- package/lib/loop/index.js +78 -150
- package/lib/math/geometry.js +28 -107
- package/lib/promise/index.js +9 -41
- package/lib/queue/index.js +96 -172
- package/lib/random/index.js +1 -32
- package/lib/regexp-list/index.js +5 -3
- package/lib/sleep/index.js +22 -129
- package/lib/stack/index.js +19 -15
- package/lib/throttle/index.js +1 -36
- package/lib/trigger/index.js +16 -10
- package/lib/watch-dog/index.js +11 -8
- package/package.json +2 -2
package/lib/throttle/index.js
CHANGED
|
@@ -1,36 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var __read = this && this.__read || function (o, n) {
|
|
4
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
5
|
-
if (!m) return o;
|
|
6
|
-
var i = m.call(o),
|
|
7
|
-
r,
|
|
8
|
-
ar = [],
|
|
9
|
-
e;
|
|
10
|
-
try {
|
|
11
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
12
|
-
} catch (error) {
|
|
13
|
-
e = {
|
|
14
|
-
error: error
|
|
15
|
-
};
|
|
16
|
-
} finally {
|
|
17
|
-
try {
|
|
18
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
19
|
-
} finally {
|
|
20
|
-
if (e) throw e.error;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
26
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
27
|
-
if (ar || !(i in from)) {
|
|
28
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
29
|
-
ar[i] = from[i];
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
33
|
-
};
|
|
34
3
|
Object.defineProperty(exports, "__esModule", {
|
|
35
4
|
value: true
|
|
36
5
|
});
|
|
@@ -39,10 +8,6 @@ function throttle(cb, time) {
|
|
|
39
8
|
var t;
|
|
40
9
|
var onOff = true;
|
|
41
10
|
return function () {
|
|
42
|
-
var args = [];
|
|
43
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
44
|
-
args[_i] = arguments[_i];
|
|
45
|
-
}
|
|
46
11
|
if (!t) {
|
|
47
12
|
t = setTimeout(function () {
|
|
48
13
|
onOff = true;
|
|
@@ -51,7 +16,7 @@ function throttle(cb, time) {
|
|
|
51
16
|
}
|
|
52
17
|
if (onOff) {
|
|
53
18
|
onOff = false;
|
|
54
|
-
cb.apply(void 0,
|
|
19
|
+
cb.apply(void 0, arguments);
|
|
55
20
|
}
|
|
56
21
|
};
|
|
57
22
|
}
|
package/lib/trigger/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
7
|
Object.defineProperty(exports, "__esModule", {
|
|
4
8
|
value: true
|
|
5
9
|
});
|
|
6
10
|
exports.ContinuousTrigger = void 0;
|
|
7
|
-
var ContinuousTrigger =
|
|
11
|
+
var ContinuousTrigger = /*#__PURE__*/function () {
|
|
8
12
|
function ContinuousTrigger(props) {
|
|
13
|
+
this.timeout = void 0;
|
|
9
14
|
this._count = 0;
|
|
15
|
+
this.props = void 0;
|
|
10
16
|
this.props = props;
|
|
11
17
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return this._count;
|
|
15
|
-
},
|
|
16
|
-
enumerable: false,
|
|
17
|
-
configurable: true
|
|
18
|
-
});
|
|
19
|
-
ContinuousTrigger.prototype.increment = function () {
|
|
18
|
+
var _proto = ContinuousTrigger.prototype;
|
|
19
|
+
_proto.increment = function increment() {
|
|
20
20
|
var _this = this;
|
|
21
21
|
clearTimeout(this.timeout);
|
|
22
22
|
this.timeout = setTimeout(function () {
|
|
@@ -27,9 +27,15 @@ var ContinuousTrigger = /** @class */function () {
|
|
|
27
27
|
this.props.cb();
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
_proto.clear = function clear() {
|
|
31
31
|
this._count = 0;
|
|
32
32
|
};
|
|
33
|
+
_createClass(ContinuousTrigger, [{
|
|
34
|
+
key: "count",
|
|
35
|
+
get: function get() {
|
|
36
|
+
return this._count;
|
|
37
|
+
}
|
|
38
|
+
}]);
|
|
33
39
|
return ContinuousTrigger;
|
|
34
40
|
}();
|
|
35
41
|
exports.ContinuousTrigger = ContinuousTrigger;
|
package/lib/watch-dog/index.js
CHANGED
|
@@ -4,27 +4,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.WatchDog = void 0;
|
|
7
|
-
var WatchDog =
|
|
8
|
-
function WatchDog(
|
|
9
|
-
var
|
|
10
|
-
limit =
|
|
11
|
-
onTimeout =
|
|
7
|
+
var WatchDog = /*#__PURE__*/function () {
|
|
8
|
+
function WatchDog(_ref) {
|
|
9
|
+
var _ref$limit = _ref.limit,
|
|
10
|
+
limit = _ref$limit === void 0 ? 10 : _ref$limit,
|
|
11
|
+
onTimeout = _ref.onTimeout;
|
|
12
12
|
this.limit = 10;
|
|
13
|
+
this.onTimeout = void 0;
|
|
13
14
|
this.timeout = null;
|
|
14
15
|
this.limit = limit;
|
|
15
16
|
this.onTimeout = onTimeout;
|
|
16
17
|
}
|
|
17
|
-
WatchDog.prototype
|
|
18
|
+
var _proto = WatchDog.prototype;
|
|
19
|
+
_proto.feed = function feed() {
|
|
18
20
|
this.init();
|
|
19
21
|
};
|
|
20
|
-
|
|
22
|
+
_proto.init = function init() {
|
|
21
23
|
var _this = this;
|
|
22
24
|
clearTimeout(this.timeout);
|
|
25
|
+
delete this.timeout;
|
|
23
26
|
this.timeout = setTimeout(function () {
|
|
24
27
|
return _this.onTimeout();
|
|
25
28
|
}, this.limit * 1000);
|
|
26
29
|
};
|
|
27
|
-
|
|
30
|
+
_proto.stop = function stop() {
|
|
28
31
|
if (this.timeout) {
|
|
29
32
|
clearTimeout(this.timeout);
|
|
30
33
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pubo-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.142",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">=8.0.0"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "9a466fcb0ddd31ae88209918dbd8ce25726aabdf",
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@babel/cli": "^7.10.1",
|
|
24
24
|
"@babel/core": "^7.10.2",
|