@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.
@@ -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
- this.#flag = true;
2496
+ that.#flag = true;
2496
2497
  };
2497
2498
  /**
2498
2499
  * 解锁
2499
2500
  */
2500
2501
  this.unlock = function () {
2501
2502
  setTimeout(() => {
2502
- this.#flag = false;
2503
- }, this.#delayTime);
2503
+ that.#flag = false;
2504
+ }, that.#delayTime);
2504
2505
  };
2505
2506
  /**
2506
2507
  * 判断是否被锁
2507
2508
  */
2508
2509
  this.isLock = function () {
2509
- return this.#flag;
2510
+ return that.#flag;
2510
2511
  };
2511
2512
  /**
2512
2513
  * 执行
2513
2514
  */
2514
2515
  this.run = async function (...args) {
2515
- if (this.isLock()) {
2516
+ if (that.isLock()) {
2516
2517
  return;
2517
2518
  }
2518
- this.lock();
2519
- await this.#callback.apply(this.#context, args);
2520
- this.unlock();
2519
+ that.lock();
2520
+ await that.#callback.apply(that.#context, args);
2521
+ that.unlock();
2521
2522
  };
2522
2523
  }
2523
2524
  }