12345678910111213141516171819202122232425262728293031 |
- 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<Ifc>[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<any>
- fire: (rpcname:string, ...args: any[]) => Promise<any>
- on: T.OnFunction
- emit: (eventName: string, data:any) => void
- close() : void
- }
-
- export interface Destroyable{
- destroy() : void
- }
|