@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.
@@ -2481,6 +2481,7 @@ System.register('Utils', [], (function (exports) {
2481
2481
  run;
2482
2482
  isLock;
2483
2483
  constructor(callback, context, delayTime) {
2484
+ let that = this;
2484
2485
  this.#callback = callback;
2485
2486
  if (typeof context === "number") {
2486
2487
  this.#delayTime = context;
@@ -2494,32 +2495,32 @@ System.register('Utils', [], (function (exports) {
2494
2495
  * 锁
2495
2496
  */
2496
2497
  this.lock = function () {
2497
- this.#flag = true;
2498
+ that.#flag = true;
2498
2499
  };
2499
2500
  /**
2500
2501
  * 解锁
2501
2502
  */
2502
2503
  this.unlock = function () {
2503
2504
  setTimeout(() => {
2504
- this.#flag = false;
2505
- }, this.#delayTime);
2505
+ that.#flag = false;
2506
+ }, that.#delayTime);
2506
2507
  };
2507
2508
  /**
2508
2509
  * 判断是否被锁
2509
2510
  */
2510
2511
  this.isLock = function () {
2511
- return this.#flag;
2512
+ return that.#flag;
2512
2513
  };
2513
2514
  /**
2514
2515
  * 执行
2515
2516
  */
2516
2517
  this.run = async function (...args) {
2517
- if (this.isLock()) {
2518
+ if (that.isLock()) {
2518
2519
  return;
2519
2520
  }
2520
- this.lock();
2521
- await this.#callback.apply(this.#context, args);
2522
- this.unlock();
2521
+ that.lock();
2522
+ await that.#callback.apply(that.#context, args);
2523
+ that.unlock();
2523
2524
  };
2524
2525
  }
2525
2526
  }