import { IDisposable, Uri } from 'monaco-editor'; /** * Change each callback of the type param to a promisified version. */ export declare type PromisifiedWorker = { [K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => Promise> : never; }; /** * A function for getting the worker client proxy with synchronized resources. * * @param args - The resource uris to synchronize. * @returns The worker client proxy. */ export declare type WorkerGetter = (...args: Uri[]) => Promise>; export interface WorkerManagerOptions { /** * The data to send over when creating the worker. */ createData?: C; /** * How often to check if a worker is idle in milliseconds. * * @default 30_000 // 30 seconds */ interval?: number; /** * A label to be used to identify the web worker. */ label: string; /** * The module to be used to identify the web worker. */ moduleId: string; /** * The worker is stopped after this time has passed in milliseconds. * * Set to Infinity to never stop the worker. * * @default 120_000 // 2 minutes */ stopWhenIdleFor?: number; } export interface WorkerManager extends IDisposable { /** * A function for getting the worker client proxy with synchronized resources. * * @param args - The resource uris to synchronize. * @returns The worker client proxy. */ getWorker: WorkerGetter; /** * Reload the worker with new create data. */ updateCreateData: (createData: C) => void; } /** * Create a worker manager. * * A worker manager is an object which deals with Monaco based web workers, such as cleanups and * idle timeouts. * * @param monaco - The Monaco editor module. * @param options - The options of the worker manager. * @returns The worker manager. */ export declare function createWorkerManager(monaco: Pick, options: WorkerManagerOptions): WorkerManager;