UNPKG

850 BTypeScriptView Raw
1export interface WorkerInput<IN = any> {
2 /**
3 * Index of the chunk received (global), which identifies the message. Starts with 0.
4 */
5 index: number;
6 /**
7 * Input chunk data.
8 */
9 payload: IN;
10}
11export interface WorkerOutput<OUT = any> {
12 /**
13 * Index of the chunk received (global), which identifies the message. Starts with 0.
14 */
15 index: number;
16 /**
17 * Output of the worker.
18 */
19 payload: OUT;
20 /**
21 * Returned if WorkerClass.process returned an error (rejected Promise).
22 * Payload is undefined in such case, so error should be checked first.
23 */
24 error?: Error;
25}
26export interface BaseWorkerData {
27 workerFile: string;
28 /**
29 * @default worker
30 */
31 metric: string;
32 workerIndex: number;
33 /**
34 * @default 1000
35 */
36 logEvery: number;
37}