@ch1/rpc
Version:
JavaScript Remote Procedure Call (RPC)
26 lines (25 loc) • 1.71 kB
TypeScript
import { FunctionalState, RemoteDesc, RPCAsyncContainer, RPCAsyncContainerDictionary, RPCConfig, RPCEvent, RPCErrorPayload, RPCPayload, RPCReturnPayload } from './interfaces';
export declare function createFunctionalState(): FunctionalState;
export declare function create(config: RPCConfig, callbacks: any, remoteDesc: RemoteDesc): Promise<{
off: () => Promise<void>;
remoteDesc: RemoteDesc;
}>;
export declare function createInitializationState(config: RPCConfig, remoteDesc: RemoteDesc, id: string): {
clean: () => void;
defer: import("./interfaces").RPCDefer<{}>;
id: string;
isCreated: boolean;
hasCreated: boolean;
localRemoteDesc: any;
stopCreateSpam: () => void;
};
export declare function initialize(config: RPCConfig, initState: any): Promise<RemoteDesc>;
export declare function ack(c: RPCConfig, event: RPCEvent): void;
export declare function sendAck(c: RPCConfig, id: string): void;
export declare function invoke(c: RPCConfig, payload: RPCPayload, id: string): void;
export declare function fireError(c: RPCConfig, payload: RPCErrorPayload, asyncReturn: RPCAsyncContainer<any>): void;
export declare function fireSuccess(c: any, payload: RPCReturnPayload, asyncReturn: RPCAsyncContainer<any>): void;
export declare function returnPayload(c: RPCConfig, payload: RPCPayload, callbacks: RPCAsyncContainerDictionary, id: string): void;
export declare function promise(c: RPCConfig, payload: RPCPayload, id: string): void;
export declare function on(sendAckFn: (c: RPCConfig, id: string) => void, c: RPCConfig, callbacks: RPCAsyncContainerDictionary, id: string): () => any;
export declare function bootstrap(functionalState: FunctionalState): FunctionalState;