/** * 通常我们将先进入 opened 状态的称为 endpoint-0,其次是 endpoint-1 */ import { type $ReadyonlyStateSignal } from "@dweb-browser/helper/StateSignal.ts"; import type { Ipc } from "../ipc.js"; import type { $EndpointIpcMessage } from "./EndpointIpcMessage.js"; import { ENDPOINT_PROTOCOL, type $EndpointLifecycle } from "./EndpointLifecycle.js"; export declare abstract class IpcEndpoint { readonly debugId: string; readonly console: any; constructor(debugId: string); abstract toString(): string; private accPid; /** * 注册一个Pid * endpoint-0 的 ipc-fork 出来的 pid 是偶数 * endpoint-1 的 ipc-fork 出来的 pid 是奇数 */ generatePid: () => number; /** * 发送消息 */ abstract postIpcMessage(msg: $EndpointIpcMessage): Promise; /** * @internal * 获取消息管道 */ private ipcMessageProducers; private ipcMessageProducer; /**获取ipc消息的生产者 */ getIpcMessageProducer(pid: number): any; /**通过ipc拿到ipc消息生产者对象 */ getIpcMessageProducerByIpc(ipc: Ipc): any; /** * 本地的生命周期状态流 */ protected lifecycleLocaleFlow: any; /** * 生命周期 监听器 */ onLifecycle: any; /** * 当前生命周期 */ get lifecycle(): any; /** * 远端的生命周期状态流 */ protected abstract lifecycleRemoteFlow: $ReadyonlyStateSignal<$EndpointLifecycle>; /** * 向远端发送 生命周期 信号 */ protected abstract sendLifecycleToRemote(state: $EndpointLifecycle): void; /** * 是否处于可以发送消息的状态 */ get isActivity(): boolean; /** * 获取支持的协议,在协商的时候会用到 */ protected abstract getLocaleSubProtocols(): Set; /** * 启动生命周期的相关的工作 */ abstract doStart(): void; start(isAwait?: boolean): Promise; readonly localSessionId: string; /**启动 */ startOnce: any; /**等待启动 */ awaitOpen(reason?: string): Promise; protected closedPo: any; private _isClose; get isClose(): boolean; close(cause?: string): Promise; awaitClosed(): any; doClose(cause?: string): Promise; protected beforeClose?: (cause?: string) => void; protected afterClosed?: (cause?: string) => void; } //# sourceMappingURL=IpcEndpoint.d.ts.map