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.
 
 
 

12 lines
703 B

import { RpcProcedure } from './RpcProcedure';
import { RpcMessagePort } from './RpcMessagePort';
declare type RpcCallHandler<TPayload = any, TResult = any> = (payload: TPayload) => Promise<TResult>;
interface RpcService {
readonly isOpen: () => boolean;
readonly open: () => Promise<void>;
readonly close: () => Promise<void>;
readonly addCallHandler: <TPayload, TResult>(procedure: RpcProcedure<TPayload, TResult>, handler: RpcCallHandler<TPayload, TResult>) => void;
readonly removeCallHandler: <TPayload, TResult>(procedure: RpcProcedure<TPayload, TResult>) => void;
}
declare function createRpcService(port: RpcMessagePort): RpcService;
export { RpcService, createRpcService };