@cheprasov/worker-thread
Version:
The WorkerThread wraps a Web Worker with a Promise, also the class creates a worker script on the fly (without having to create separate worker files). You can 'inline' your worker function in the same js file as main logic.
23 lines (16 loc) • 373 B
JavaScript
// @flow strict
export default class WorkerError extends Error {
type: string;
data: any;
constructor(type: string, message: ?string = '', data: any = null) {
super(message);
this.type = type;
this.data = data;
}
getType(): string {
return this.type;
}
getData(): string {
return this.data;
}
}