@hile/message-modem 1.0.4 → 1.0.6

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.d.ts CHANGED
@@ -19,6 +19,7 @@ export declare abstract class MessageModem {
19
19
  private id;
20
20
  private readonly aborts;
21
21
  private readonly stacks;
22
+ protected _dispose(): void;
22
23
  /**
23
24
  * 创建自增 ID
24
25
  * 超过最大安全整数时重置为 0
package/dist/index.js CHANGED
@@ -10,6 +10,16 @@ export class MessageModem {
10
10
  id = 0;
11
11
  aborts = new Map();
12
12
  stacks = new Map();
13
+ _dispose() {
14
+ for (const { reject } of this.stacks.values()) {
15
+ reject(new AbortException());
16
+ }
17
+ for (const reject of this.aborts.values()) {
18
+ reject(new AbortException());
19
+ }
20
+ this.aborts.clear();
21
+ this.stacks.clear();
22
+ }
13
23
  /**
14
24
  * 创建自增 ID
15
25
  * 超过最大安全整数时重置为 0
@@ -112,7 +122,7 @@ export class MessageModem {
112
122
  else {
113
123
  _reject(new TimeoutException());
114
124
  }
115
- }, timeout);
125
+ }, timeout).unref();
116
126
  // 添加 Abort 处理函数
117
127
  controller.signal.addEventListener('abort', aborthandler);
118
128
  // 添加栈
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hile/message-modem",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -21,5 +21,5 @@
21
21
  "fix-esm-import-path": "^1.10.3",
22
22
  "vitest": "^4.0.18"
23
23
  },
24
- "gitHead": "14216a0622f27cc08f3c995fce0e2b5f9133e130"
24
+ "gitHead": "fabc6e8b039b9ac6bf3267b825f7295d04111264"
25
25
  }