import { Thread, type ThreadOptions, type ThreadMessageTarget } from '../Thread.ts'; export interface ThreadWindowOptions, Exports = Record> extends ThreadOptions { targetOrigin?: string; } /** * Creates a thread from a `Window` created by this environment. * * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe * * @example * import {ThreadWindow} from '@quilted/threads'; * * const popup = window.open('https://my-app.com/popup', 'MyAppPopup', 'popup'); * const thread = new ThreadWindow(popup); * await thread.imports.sendMessage('Hello world!'); */ export declare class ThreadWindow, Exports = Record> extends Thread { readonly window: Window; /** * Creates a thread from a `Window` created by this environment. * * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe * * @example * import {ThreadWindow} from '@quilted/threads'; * * const popup = window.open('https://my-app.com/popup', 'MyAppPopup', 'popup'); * const thread = ThreadWindow.from(popup); * await thread.imports.sendMessage('Hello world!'); */ static from, Exports = Record>(window: Window, options?: ThreadWindowOptions): ThreadWindow; /** * Starts a thread wrapped around a `window` object, and returns the imports * of the thread. * * @example * ```ts * import {ThreadWindow} from '@quilted/threads'; * * const {getMessage} = ThreadWindow.import(window); * const message = await getMessage(); // 'Hello, world!' * * // In the nested window: * * import {ThreadNestedWindow} from '@quilted/threads'; * * ThreadNestedWindow.export(window.opener, { * async getMessage() { * return 'Hello, world!'; * }, * }); * ``` */ static import>(window: Window, options?: Omit>, 'exports'>): import("../Thread.ts").ThreadImports; /** * Starts a thread wrapped around a `window` object, providing the second * argument as the exports of the thread. * * @example * ```ts * import {ThreadWindow} from '@quilted/threads'; * * ThreadWindow.export(window, { * async getMessage() { * return 'Hello, world!'; * }, * }); * * // In the nested window: * * import {ThreadNestedWindow} from '@quilted/threads'; * * const {getMessage} = ThreadNestedWindow.import(window.opener); * const message = await getMessage(); // 'Hello, world!' * ``` */ static export>(window: Window, exports: Exports, options?: Omit, NoInfer>, 'exports' | 'imports'>): void; /** * Creates a thread from an `