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.
 
 
 

14 lines
763 B

declare type RpcMessageDispatch = <TMessage>(message: TMessage) => Promise<void>;
declare type RpcMessageListener = RpcMessageDispatch;
declare type RpcErrorListener = (error: Error) => void;
interface RpcMessagePort {
readonly dispatchMessage: RpcMessageDispatch;
readonly addMessageListener: (listener: RpcMessageListener) => void;
readonly removeMessageListener: (listener: RpcMessageListener) => void;
readonly addErrorListener: (listener: RpcErrorListener) => void;
readonly removeErrorListener: (listener: RpcErrorListener) => void;
readonly isOpen: () => boolean;
readonly open: () => Promise<void>;
readonly close: () => Promise<void>;
}
export { RpcMessagePort, RpcMessageDispatch, RpcMessageListener, RpcErrorListener };