-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.d.ts
48 lines (40 loc) · 1.12 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
export class FuncWork {
private options: WorkerOptions;
private worker?: Worker;
private scriptUrl: string;
private methodMap: Map<string, Function>;
private genCodeString(): string;
/**
* create FuncWork instance
* @param options WorkerOptions
*/
constructor(options?: WorkerOptions)
/**
* register function
* @param methods The functions to be registered
*/
add(...methods: Function[]): this;
/**
* remove function that was registered before
* @param name The function or the name of the function to be removed
*/
remove(name: string | Function): void;
/**
* invoke function that was registered before
* @param name The function or the name of the function to be called
* @param params The parameters that the function accepts, it must be of array type, whether single argument or multiple arguments
*/
invoke(name: string | Function, params?: any): never | Promise<any>
/**
* clear all functions
*/
clear(): void;
/**
* list all registered functions
*/
list(): string;
/**
* destroy Funcwork instance and clear all data
*/
destroy(): void;
}