vivth 1.4.6 → 1.4.7

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/README.md CHANGED
@@ -2594,7 +2594,7 @@ export const myDoubleWorker = WorkerMainThread.newVivthWorker(
2594
2594
  * @param {boolean} terminateAllReactivity
2595
2595
  * - false: only terminate `Worker` instance;
2596
2596
  * - true: also terminate `Signal`s and `Effect`s;
2597
- * @return {void}
2597
+ * @return {Promise<void>}
2598
2598
  */
2599
2599
  ```
2600
2600
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vivth",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
4
4
  "description": "library primitives",
5
5
  "main": "index.mjs",
6
6
  "types": "./types/index.d.mts",
@@ -241,7 +241,7 @@ export class WorkerMainThread {
241
241
  if (worker.#worker.value) {
242
242
  worker.#worker.value.postMessage(closeWorkerThreadEventObject, []);
243
243
  }
244
- worker.terminate(true);
244
+ await worker.terminate(true);
245
245
  });
246
246
  }
247
247
  }
@@ -269,13 +269,13 @@ export class WorkerMainThread {
269
269
  * @param {boolean} terminateAllReactivity
270
270
  * - false: only terminate `Worker` instance;
271
271
  * - true: also terminate `Signal`s and `Effect`s;
272
- * @return {void}
272
+ * @return {Promise<void>}
273
273
  */
274
- terminate = (terminateAllReactivity) => {
274
+ terminate = async (terminateAllReactivity) => {
275
275
  /**
276
276
  * this is more for browser, as most of this are automatically cleaned with `SafeExit`;
277
277
  */
278
- this.#worker.value?.terminate();
278
+ await this.#worker.value?.terminate();
279
279
  if (!terminateAllReactivity) {
280
280
  return;
281
281
  }
@@ -174,7 +174,7 @@ export class WorkerMainThread {
174
174
  if (worker.#worker.value) {
175
175
  worker.#worker.value.postMessage(closeWorkerThreadEventObject, []);
176
176
  }
177
- worker.terminate(true);
177
+ await worker.terminate(true);
178
178
  });
179
179
  }
180
180
  }
@@ -197,14 +197,14 @@ export class WorkerMainThread {
197
197
  worker.postMessage(postData, []);
198
198
  });
199
199
  /**
200
- * @param {boolean} [terminateAllReactivity]
201
- * @return {void}
200
+ * @param {boolean} terminateAllReactivity
201
+ * @return {Promise<void>}
202
202
  */
203
- terminate = (terminateAllReactivity = false) => {
203
+ terminate = async (terminateAllReactivity) => {
204
204
  /**
205
205
  * this is more for browser, as most of this are automatically cleaned with `SafeExit`;
206
206
  */
207
- this.#worker.value?.terminate();
207
+ await this.#worker.value?.terminate();
208
208
  if (!terminateAllReactivity) {
209
209
  return;
210
210
  }
@@ -121,9 +121,9 @@ export class WorkerMainThread<WT extends WorkerThread<any, any>> {
121
121
  * @param {boolean} terminateAllReactivity
122
122
  * - false: only terminate `Worker` instance;
123
123
  * - true: also terminate `Signal`s and `Effect`s;
124
- * @return {void}
124
+ * @return {Promise<void>}
125
125
  */
126
- terminate: (terminateAllReactivity: boolean) => void;
126
+ terminate: (terminateAllReactivity: boolean) => Promise<void>;
127
127
  /**
128
128
  * @description
129
129
  * - result signal of the processed message;
@@ -64,10 +64,10 @@ export class WorkerMainThread<WT extends WorkerThread<any, any>> {
64
64
  */
65
65
  constructor(handler: Parameters<(typeof WorkerMainThread<WT>)["newVivthWorker"]>[0], options?: Parameters<(typeof WorkerMainThread<WT>)["newVivthWorker"]>[1]);
66
66
  /**
67
- * @param {boolean} [terminateAllReactivity]
68
- * @return {void}
67
+ * @param {boolean} terminateAllReactivity
68
+ * @return {Promise<void>}
69
69
  */
70
- terminate: (terminateAllReactivity?: boolean) => void;
70
+ terminate: (terminateAllReactivity: boolean) => Promise<void>;
71
71
  /**
72
72
  * @type {Derived<WorkerResult<WT["POST"]>>}
73
73
  */