*/
constructor(workerScript: string, workerOptions: WorkerOptions) {
super(workerScript, workerOptions);
- if (
- this.workerOptions.elementsPerWorker === null ||
- this.workerOptions.elementsPerWorker === undefined
- ) {
+ if (this.workerOptions.elementsPerWorker == null) {
throw new TypeError('Elements per worker is not defined');
}
if (!Number.isSafeInteger(this.workerOptions.elementsPerWorker)) {
await waitWorkerExit;
this.emitter?.emit(WorkerSetEvents.stopped, this.info);
this.emitter?.emitDestroy();
+ this.emitter?.removeAllListeners();
this.started = false;
}
}
if (!this.started) {
throw new Error('Cannot add a WorkerSet element: not started');
}
- if (!this.workerSet) {
+ if (this.workerSet == null) {
throw new Error("Cannot add a WorkerSet element: 'workerSet' property does not exist");
}
const workerSetElement = await this.getWorkerSetElement();