@whitesev/utils 1.1.1 → 1.1.2
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/index.amd.js +9 -8
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +9 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +9 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +9 -8
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +9 -8
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +9 -8
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/LockFunction.ts +9 -9
package/dist/index.iife.js
CHANGED
|
@@ -2479,6 +2479,7 @@ var Utils = (function () {
|
|
|
2479
2479
|
run;
|
|
2480
2480
|
isLock;
|
|
2481
2481
|
constructor(callback, context, delayTime) {
|
|
2482
|
+
let that = this;
|
|
2482
2483
|
this.#callback = callback;
|
|
2483
2484
|
if (typeof context === "number") {
|
|
2484
2485
|
this.#delayTime = context;
|
|
@@ -2492,32 +2493,32 @@ var Utils = (function () {
|
|
|
2492
2493
|
* 锁
|
|
2493
2494
|
*/
|
|
2494
2495
|
this.lock = function () {
|
|
2495
|
-
|
|
2496
|
+
that.#flag = true;
|
|
2496
2497
|
};
|
|
2497
2498
|
/**
|
|
2498
2499
|
* 解锁
|
|
2499
2500
|
*/
|
|
2500
2501
|
this.unlock = function () {
|
|
2501
2502
|
setTimeout(() => {
|
|
2502
|
-
|
|
2503
|
-
},
|
|
2503
|
+
that.#flag = false;
|
|
2504
|
+
}, that.#delayTime);
|
|
2504
2505
|
};
|
|
2505
2506
|
/**
|
|
2506
2507
|
* 判断是否被锁
|
|
2507
2508
|
*/
|
|
2508
2509
|
this.isLock = function () {
|
|
2509
|
-
return
|
|
2510
|
+
return that.#flag;
|
|
2510
2511
|
};
|
|
2511
2512
|
/**
|
|
2512
2513
|
* 执行
|
|
2513
2514
|
*/
|
|
2514
2515
|
this.run = async function (...args) {
|
|
2515
|
-
if (
|
|
2516
|
+
if (that.isLock()) {
|
|
2516
2517
|
return;
|
|
2517
2518
|
}
|
|
2518
|
-
|
|
2519
|
-
await
|
|
2520
|
-
|
|
2519
|
+
that.lock();
|
|
2520
|
+
await that.#callback.apply(that.#context, args);
|
|
2521
|
+
that.unlock();
|
|
2521
2522
|
};
|
|
2522
2523
|
}
|
|
2523
2524
|
}
|