-
Notifications
You must be signed in to change notification settings - Fork 33
/
index.d.ts
37 lines (33 loc) · 907 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
interface Options {
autoStart?: boolean;
lazyStart?: boolean;
asyncWorkerInitialization?: boolean;
minWorkers?: number;
maxWorkers?: number;
maxTasks?: number;
maxTasksPerWorker?: number;
taskTimeout?: number;
taskMaxRetries?: number;
workerEndurance?: number;
workerStopTimeout?: number;
workerType?: "thread" | "process";
}
interface WorkerNodesInstance {
call: CallProperty;
ready: () => Promise<WorkerNodesInstance>;
terminate: () => Promise<WorkerNodesInstance>;
profiler: (duration?: number) => void;
takeSnapshot: () => void;
getUsedWorkers: () => Array<Worker>;
}
interface CallProperty {
(...args: any[]): Promise<any>;
[method: string]: (...args: any[]) => Promise<any>;
}
interface WorkerNodes {
new (name: string, options?: Options): WorkerNodesInstance;
}
declare module "worker-nodes" {
const workerNodes: WorkerNodes;
export = workerNodes;
}