import * as T from "./Types"; import * as I from "./Interfaces" /** * Interface for all classes that export RPCs */ export type RPCExporter< Ifc extends T.RPCInterface = T.RPCInterface, Name extends keyof Ifc = string, > = { name: Name exportRPCs() : T.RPCDefinitions[Name] } /** * Generic socket interface that can apply to bsock as well as RPCSocket */ export interface Socket extends Destroyable { port: number hook: (rpcname: string, handler: T.AnyFunction) => void unhook: (rpcname:string) => void call: (rpcname:string, ...args: any[]) => Promise fire: (rpcname:string, ...args: any[]) => Promise on: T.OnFunction emit: (eventName: string, data:any) => void close() : void } export interface Destroyable{ destroy() : void }