/** * A tiny and mostly spec-compliant `WebWorker` shim * * This `WebWorker` shim is implemented on top of an `IFrameElement` to allow * workers in contexts when `XMLHTTPRequest` is not available, or blocked by the * browser, e.g. when using the `file://` protocol. This shim can't provide * asynchronous workers, as iframes are synchronous by nature. */ export declare class IFrameWorker extends EventTarget implements Worker { protected url: URL | string; addEventListener: Worker["addEventListener"]; removeEventListener: Worker["removeEventListener"]; dispatchEvent: Worker["dispatchEvent"]; onerror: Worker["onerror"]; onmessage: Worker["onmessage"]; onmessageerror: Worker["onmessageerror"]; /** * The `iframe` we'll use to simulate a worker */ iframe: HTMLIFrameElement; /** * A promise indicating whether the `iframe` was initialized */ protected r: Promise; /** * Create a new worker from the given URL * * @param url - Worker script URL */ constructor(url: URL | string); /** * Immediately terminate the worker */ terminate(): void; /** * Send a message to the worker * * @param data - Message data */ postMessage(data: unknown): void; /** * Helper to retrieve the content window of the `iframe` * * If the window doesn't exist, e.g. when the `iframe` has been removed by * terminating the worker, an error is thrown. * * @returns Window */ protected get w(): Window; /** * Internal listener that proxies message events * * @param ev - Message event */ protected m: (ev: MessageEvent) => void; /** * Internal listener that proxies error events * * @param message - Error message * @param filename - Source filename * @param lineno - Source line number * @param colno - Source column number * @param error - Error object */ protected e: (message?: string, filename?: string, lineno?: number, colno?: number, error?: Error) => void; } //# sourceMappingURL=index.d.ts.map