vivth 1.4.5 → 1.4.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/README.md
CHANGED
|
@@ -2591,7 +2591,10 @@ export const myDoubleWorker = WorkerMainThread.newVivthWorker(
|
|
|
2591
2591
|
|
|
2592
2592
|
```js
|
|
2593
2593
|
/**
|
|
2594
|
-
* @
|
|
2594
|
+
* @param {boolean} terminateAllReactivity
|
|
2595
|
+
* - false: only terminate `Worker` instance;
|
|
2596
|
+
* - true: also terminate `Signal`s and `Effect`s;
|
|
2597
|
+
* @return {void}
|
|
2595
2598
|
*/
|
|
2596
2599
|
```
|
|
2597
2600
|
|
package/package.json
CHANGED
|
@@ -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();
|
|
244
|
+
worker.terminate(true);
|
|
245
245
|
});
|
|
246
246
|
}
|
|
247
247
|
}
|
|
@@ -266,13 +266,19 @@ export class WorkerMainThread {
|
|
|
266
266
|
/**
|
|
267
267
|
* @description
|
|
268
268
|
* - terminate all signals that are used on this instance;
|
|
269
|
-
* @
|
|
269
|
+
* @param {boolean} terminateAllReactivity
|
|
270
|
+
* - false: only terminate `Worker` instance;
|
|
271
|
+
* - true: also terminate `Signal`s and `Effect`s;
|
|
272
|
+
* @return {void}
|
|
270
273
|
*/
|
|
271
|
-
terminate = () => {
|
|
274
|
+
terminate = (terminateAllReactivity) => {
|
|
272
275
|
/**
|
|
273
276
|
* this is more for browser, as most of this are automatically cleaned with `SafeExit`;
|
|
274
277
|
*/
|
|
275
278
|
this.#worker.value?.terminate();
|
|
279
|
+
if (!terminateAllReactivity) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
276
282
|
this.#worker.remove.ref();
|
|
277
283
|
this.#handler.options.removeEffect();
|
|
278
284
|
this.#proxyPost.remove.ref();
|
|
@@ -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();
|
|
177
|
+
worker.terminate(true);
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
}
|
|
@@ -197,13 +197,17 @@ export class WorkerMainThread {
|
|
|
197
197
|
worker.postMessage(postData, []);
|
|
198
198
|
});
|
|
199
199
|
/**
|
|
200
|
-
* @
|
|
200
|
+
* @param {boolean} [terminateAllReactivity]
|
|
201
|
+
* @return {void}
|
|
201
202
|
*/
|
|
202
|
-
terminate = () => {
|
|
203
|
+
terminate = (terminateAllReactivity = false) => {
|
|
203
204
|
/**
|
|
204
205
|
* this is more for browser, as most of this are automatically cleaned with `SafeExit`;
|
|
205
206
|
*/
|
|
206
207
|
this.#worker.value?.terminate();
|
|
208
|
+
if (!terminateAllReactivity) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
207
211
|
this.#worker.remove.ref();
|
|
208
212
|
this.#handler.options.removeEffect();
|
|
209
213
|
this.#proxyPost.remove.ref();
|
|
@@ -118,9 +118,12 @@ export class WorkerMainThread<WT extends WorkerThread<any, any>> {
|
|
|
118
118
|
/**
|
|
119
119
|
* @description
|
|
120
120
|
* - terminate all signals that are used on this instance;
|
|
121
|
-
* @
|
|
121
|
+
* @param {boolean} terminateAllReactivity
|
|
122
|
+
* - false: only terminate `Worker` instance;
|
|
123
|
+
* - true: also terminate `Signal`s and `Effect`s;
|
|
124
|
+
* @return {void}
|
|
122
125
|
*/
|
|
123
|
-
terminate: () => void;
|
|
126
|
+
terminate: (terminateAllReactivity: boolean) => void;
|
|
124
127
|
/**
|
|
125
128
|
* @description
|
|
126
129
|
* - result signal of the processed message;
|
|
@@ -64,9 +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
|
-
* @
|
|
67
|
+
* @param {boolean} [terminateAllReactivity]
|
|
68
|
+
* @return {void}
|
|
68
69
|
*/
|
|
69
|
-
terminate: () => void;
|
|
70
|
+
terminate: (terminateAllReactivity?: boolean) => void;
|
|
70
71
|
/**
|
|
71
72
|
* @type {Derived<WorkerResult<WT["POST"]>>}
|
|
72
73
|
*/
|