import { Thread, type ThreadOptions } from '../Thread.ts'; /** * Creates a thread from a `BroadcastChannel` instance in the browser. * * @see https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel * * @example * import {ThreadBroadcastChannel} from '@quilted/threads'; * * const channel = new BroadcastChannel('my-channel');; * const thread = new ThreadBroadcastChannel(channel); * await thread.imports.sendMessage('Hello world!'); */ export declare class ThreadBroadcastChannel, Exports = Record> extends Thread { readonly channel: BroadcastChannel; /** * Starts a thread wrapped around a `BroadcastChannel` object, and returns the imports * of the thread. * * @example * ```ts * import {ThreadBroadcastChannel} from '@quilted/threads'; * * const channel = new BroadcastChannel('my-channel'); * const {getMessage} = ThreadBroadcastChannel.import(channel); * const message = await getMessage(); // 'Hello, world!' * * // In another context (tab, window, etc.): * * import {ThreadBroadcastChannel} from '@quilted/threads'; * * const channel = new BroadcastChannel('my-channel'); * ThreadBroadcastChannel.export(channel, { * async getMessage() { * return 'Hello, world!'; * }, * }); * ``` */ static import>(channel: BroadcastChannel, options?: Omit>, 'exports'>): import("../Thread.ts").ThreadImports; /** * Starts a thread wrapped around a `BroadcastChannel` object, providing the second * argument as the exports of the thread. * * @example * ```ts * import {ThreadBroadcastChannel} from '@quilted/threads'; * * const channel = new BroadcastChannel('my-channel'); * * ThreadBroadcastChannel.export(channel, { * async getMessage() { * return 'Hello, world!'; * }, * }); * * // In another context (tab, window, etc.): * * import {ThreadBroadcastChannel} from '@quilted/threads'; * * const channel = new BroadcastChannel('my-channel'); * const {getMessage} = ThreadBroadcastChannel.import(channel); * const message = await getMessage(); // 'Hello, world!' * ``` */ static export>(channel: BroadcastChannel, exports: Exports, options?: Omit, NoInfer>, 'exports' | 'imports'>): void; constructor(channel: BroadcastChannel, options?: ThreadOptions); } //# sourceMappingURL=ThreadBroadcastChannel.d.ts.map