UNPKG

839 BTypeScriptView Raw
1import { Observable } from "observable-fns";
2import { Thread as ThreadType, WorkerEvent } from "../types/master";
3export declare type Thread = ThreadType;
4/** Thread utility functions. Use them to manage or inspect a `spawn()`-ed thread. */
5export declare const Thread: {
6 /** Return an observable that can be used to subscribe to all errors happening in the thread. */
7 errors<ThreadT extends ThreadType>(thread: ThreadT): Observable<Error>;
8 /** Return an observable that can be used to subscribe to internal events happening in the thread. Useful for debugging. */
9 events<ThreadT_1 extends ThreadType>(thread: ThreadT_1): Observable<WorkerEvent>;
10 /** Terminate a thread. Remember to terminate every thread when you are done using it. */
11 terminate<ThreadT_2 extends ThreadType>(thread: ThreadT_2): Promise<void>;
12};