UNPKG

787 BPlain TextView 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 /**
8 * Input chunk data.
9 */
10 payload: IN
11}
12
13export interface WorkerOutput<OUT = any> {
14 /**
15 * Index of the chunk received (global), which identifies the message. Starts with 0.
16 */
17 index: number
18
19 /**
20 * Output of the worker.
21 */
22 payload: OUT
23
24 /**
25 * Returned if WorkerClass.process returned an error (rejected Promise).
26 * Payload is undefined in such case, so error should be checked first.
27 */
28 error?: Error
29}
30
31export interface BaseWorkerData {
32 workerFile: string
33
34 /**
35 * @default worker
36 */
37 metric: string
38
39 workerIndex: number
40
41 /**
42 * @default 1000
43 */
44 logEvery: number
45}