import { ReadableStreamOut } from "@dweb-browser/helper/stream/readableStreamHelper.ts"; import type { Ipc } from "../../ipc.js"; import { type $IpcEvent } from "../IpcEvent.js"; import { IPC_DATA_ENCODING } from "../internal/IpcData.js"; export declare const PURE_CHANNEL_EVENT_PREFIX = "\u00A7-"; export declare const INCOME: "pureChannel.income"; export declare const OUTGOING: "pureChannel.outgoing"; export declare class PureChannel { #private; constructor(income?: ReadableStreamOut<$PureFrame>, outgoing?: ReadableStreamOut<$PureFrame>); private _startLock; afterStart(): Promise; start: (() => { "pureChannel.income": ReadableStreamOut<$PureFrame>; "pureChannel.outgoing": ReadableStreamOut<$PureFrame>; sendText: (text: string) => void; sendBinary: (binary: Uint8Array) => void; send: (frame: $PureFrame) => void; close: () => void; }) & { readonly fn: () => { "pureChannel.income": ReadableStreamOut<$PureFrame>; "pureChannel.outgoing": ReadableStreamOut<$PureFrame>; sendText: (text: string) => void; sendBinary: (binary: Uint8Array) => void; send: (frame: $PureFrame) => void; close: () => void; }; readonly hasRun: boolean; readonly result: { "pureChannel.income": ReadableStreamOut<$PureFrame>; "pureChannel.outgoing": ReadableStreamOut<$PureFrame>; sendText: (text: string) => void; sendBinary: (binary: Uint8Array) => void; send: (frame: $PureFrame) => void; close: () => void; }; reset(): void; }; close(): void; /**转换输入输出 */ reverse(): PureChannel; } export declare enum PureFrameType { Text = 0, Binary = 1 } export type $PureFrame = PureTextFrame | PureBinaryFrame; export declare class PureFrame { readonly type: T; constructor(type: T); } export declare class PureTextFrame extends PureFrame { readonly data: string; constructor(data: string); } export declare class PureBinaryFrame extends PureFrame { readonly data: Uint8Array; constructor(data: Uint8Array); } export declare const ipcEventToPureFrame: (event: $IpcEvent) => PureTextFrame | PureBinaryFrame; export declare const pureFrameToIpcEvent: (eventName: string, pureFrame: $PureFrame, orderBy?: number) => { readonly name: string; readonly data: string | Uint8Array; readonly encoding: IPC_DATA_ENCODING; readonly order: number | undefined; readonly type: import("../internal/IpcMessage.js").IPC_MESSAGE_TYPE.EVENT; }; export declare const pureChannelToIpcEvent: (channelIpc: Ipc, pureChannel: PureChannel, debugTag: string) => Promise; //# sourceMappingURL=PureChannel.d.ts.map