Function prepareRouterProtocol
- prepareRouterProtocol(zone, powers, E?): ((...args: []) => Guarded<{
bindPort(localAddr: string): Promise<Port | Vow<Port>>;
registerProtocolHandler(paths: string[], protocolHandler: Remote<ProtocolHandler>): void;
unregisterProtocolHandler(prefix: string, protocolHandler: Remote<ProtocolHandler>): void;
}>) Parameters
- zone: Zone
- powers: Powers
Optional
E: (<T>(x: T) => ECallableOrMethods<RemoteFunctions<T>>) & {
get: (<T>(x: T) => EGetters<LocalRecord<T>>);
resolve: {
(): Promise<void>;
<T>(value: T): Promise<Awaited<T>>;
<T>(value: T | PromiseLike<T>): Promise<Awaited<T>>;
};
sendOnly: (<T>(x: T) => ESendOnlyCallableOrMethods<RemoteFunctions<T>>);
when: (<T, U>(x: T | PromiseLike<T>, onfulfilled?: ((value: T) => ERef<U>), onrejected?: ((reason: any) => ERef<U>)) => Promise<U>);
} = defaultE
Returns ((...args: []) => Guarded<{
bindPort(localAddr: string): Promise<Port | Vow<Port>>;
registerProtocolHandler(paths: string[], protocolHandler: Remote<ProtocolHandler>): void;
unregisterProtocolHandler(prefix: string, protocolHandler: Remote<ProtocolHandler>): void;
}>)
- (...args): Guarded<{
bindPort(localAddr: string): Promise<Port | Vow<Port>>;
registerProtocolHandler(paths: string[], protocolHandler: Remote<ProtocolHandler>): void;
unregisterProtocolHandler(prefix: string, protocolHandler: Remote<ProtocolHandler>): void;
}> Returns Guarded<{
bindPort(localAddr: string): Promise<Port | Vow<Port>>;
registerProtocolHandler(paths: string[], protocolHandler: Remote<ProtocolHandler>): void;
unregisterProtocolHandler(prefix: string, protocolHandler: Remote<ProtocolHandler>): void;
}>
Create a router that behaves like a Protocol.