import { AsyncQueue } from './AsyncQueue'; /** * The job that a worker can execute. */ export interface Job { /** * The signal that the job was aborted by the consumer. */ signal: AbortSignal; /** * The callback that the worker must execute. * * @param signal The signal that is aborted when the job must be aborted. */ cb(signal: AbortSignal): unknown; /** * The callback that receives the fulfillment value. */ resolve(value: any): void; /** * The callback that receives an error thrown by the {@link run callback}. */ reject(reason: any): void; } /** * The worker picks a job from the queue and invokes its callbacks to fulfill or reject the underlying promise. */ export declare class Worker { /** * `true` if the worker won't consume any new jobs, or `false` otherwise. */ isTerminated: boolean; /** * The controller that aborts the most recent job. */ private _abortController; /** * The promise that resolves when the most recent job is settled. */ private _promise; /** * Creates a new {@link Worker} instance. * * @param jobQueue The queue from which the worker takes jobs. */ constructor(jobQueue: AsyncQueue); terminate(reason: any): Promise; }