You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
906 B
20 lines
906 B
import { EventInterface } from 'microevent.ts';
|
|
interface RpcProviderInterface {
|
|
dispatch(message: any): void;
|
|
rpc<T, U>(id: string, payload?: T, transfer?: Array<any>): Promise<U>;
|
|
signal<T>(id: string, payload?: T, transfer?: Array<any>): this;
|
|
registerRpcHandler<T, U>(id: string, handler: RpcProviderInterface.RpcHandler<T, U>): this;
|
|
registerSignalHandler<T>(id: string, handler: RpcProviderInterface.SignalHandler<T>): this;
|
|
deregisterRpcHandler<T, U>(id: string, handler: RpcProviderInterface.RpcHandler<T, U>): this;
|
|
deregisterSignalHandler<T>(id: string, handler: RpcProviderInterface.SignalHandler<T>): this;
|
|
error: EventInterface<Error>;
|
|
}
|
|
declare module RpcProviderInterface {
|
|
interface RpcHandler<T, U> {
|
|
(payload?: T): Promise<U> | U;
|
|
}
|
|
interface SignalHandler<T> {
|
|
(payload?: T): void;
|
|
}
|
|
}
|
|
export default RpcProviderInterface;
|
|
|