File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -76,9 +76,9 @@ export type TransferList = Transferable[]
76
76
/** Worker instance. Either a web worker or a node.js Worker provided by `worker_threads` or `tiny-worker`. */
77
77
export interface Worker extends EventTarget {
78
78
postMessage ( value : any , transferList ?: TransferList ) : void
79
- terminate ( callback ?: ( error ?: Error , exitCode ?: number ) => void ) : void
79
+ /** In nodejs 10+ return type is Promise while with tiny-worker and in browser return type is void */
80
+ terminate ( callback ?: ( error ?: Error , exitCode ?: number ) => void ) : void | Promise < number >
80
81
}
81
-
82
82
export interface ThreadsWorkerOptions extends WorkerOptions {
83
83
/** Prefix for the path passed to the Worker constructor. Web worker only. */
84
84
_baseURL ?: string
@@ -102,7 +102,7 @@ export interface ThreadsWorkerOptions extends WorkerOptions {
102
102
export declare class WorkerImplementation extends EventTarget implements Worker {
103
103
constructor ( path : string , options ?: ThreadsWorkerOptions )
104
104
public postMessage ( value : any , transferList ?: TransferList ) : void
105
- public terminate ( ) : void
105
+ public terminate ( ) : void | Promise < number >
106
106
}
107
107
108
108
/** Class to spawn workers from a blob or source string. */
You can’t perform that action at this time.
0 commit comments