/** * Messages sent from worker */ export declare enum WorkerMessageTypes { STARTED = "STARTED", TASK_FINISHED = "TASK_FINISHED", TASK_FAILED = "TASK_FAILED" } /** * Message interface from worker */ export interface WorkerMessage { message: WorkerMessageTypes; data?: any; } export declare class ParentThread { /** * Post that the worker started up successfully to the main thread * * Runs on: Worker */ workerStarted(): void; /** * Post that the worker finished a task successfully * * Runs on: Worker * * @param response Task response */ taskFinished(response?: any): void; /** * Post that the worker failed to complete a task * * Runs on: Worker * * @param response Task response */ taskFailed(error?: Error): void; /** * Post a message to the main thread * * Runs on: Worker * * @param msg */ protected post(msg: WorkerMessage): void; }