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