import { type Peer } from "cojson"; import type { WaitForConnectionOptions, ExposeOptions, PostMessageTarget } from "cojson/src/CojsonMessageChannel/types.js"; import { Account, AnonymousJazzAgent } from "jazz-tools"; /** * Options for JazzMessageChannel.expose() */ export interface JazzMessageChannelExposeOptions extends ExposeOptions { /** * The account or anonymous agent to use for the connection. * If not provided, falls back to the active account context. */ loadAs?: Account | AnonymousJazzAgent; } /** * JazzMessageChannel provides a high-level API for creating Jazz connections * via the MessageChannel API. It wraps cojson's CojsonMessageChannel and * automatically manages the node connection. */ export declare class JazzMessageChannel { /** * Expose a Jazz connection to a target. * This is the host-side API, typically called from the main thread. * * @param target - Any object with a postMessage method (Worker, Window, etc.) * @param opts - Configuration options including the account to use * @returns A promise that resolves once the connection is established */ static expose(target: PostMessageTarget, opts?: JazzMessageChannelExposeOptions): Promise; /** * Accept an incoming Jazz connection. * Same as cojson CojsonMessageChannel.waitForConnection(). */ static waitForConnection(opts?: WaitForConnectionOptions): Promise; } export type { WaitForConnectionOptions, AcceptFromPortOptions, } from "cojson/src/CojsonMessageChannel/types.js"; //# sourceMappingURL=JazzMessageChannel.d.ts.map