UNPKG

parallel-es

Version:
34 lines (33 loc) 1.3 kB
import { IWorkerMessage } from "./worker-messages"; import { DynamicFunctionRegistry } from "../function/dynamic-function-registry"; import { IWorkerThreadSlaveCommunicationChannel } from "./worker-thread-slave-communication-channel"; /** * State of the worker thread */ export declare class WorkerThreadState { name: string; constructor(name: string); /** * Called if the worker thread has received a message from a slave * @param event the received message */ onMessage(message: IWorkerMessage): void; /** * Called if a fatal error on the Slave. Errors occurring during task execution are specially handled * and passed to {@link WorkerThreadState.onMessage} * @param error */ onError(error: any): void; } /** * Worker thread is executing a function on the {@link IWorkerSlave} */ export declare class WorkerThreadExecutingState extends WorkerThreadState { private callback; private functionRegistry; private communicationChannel; constructor(callback: (error: any, result: any) => void, functionRegistry: DynamicFunctionRegistry, communicationChannel: IWorkerThreadSlaveCommunicationChannel); onMessage(message: IWorkerMessage): void; onError(error: any): void; private handleFunctionRequest(message); }