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.

Interfaces.ts 772B

12345678910111213141516171819202122232425262728293031
  1. import * as T from "./Types";
  2. import * as I from "./Interfaces"
  3. /**
  4. * Interface for all classes that export RPCs
  5. */
  6. export interface RPCExporter<
  7. Ifc extends T.RPCInterface,
  8. Name extends keyof Ifc,
  9. SubresT = {}
  10. >{
  11. name: Name
  12. exportRPCs() : T.RPCInterfaceArray<Ifc, SubresT>[Name]
  13. }
  14. /**
  15. * Generic socket interface that can apply to bsock as well as RPCSocket
  16. */
  17. export interface Socket extends Destroyable {
  18. port: number
  19. hook: (rpcname: string, handler: T.AnyFunction) => I.Socket
  20. unhook: (rpcname:string) => I.Socket
  21. call: (rpcname:string, ...args: any[]) => Promise<any>
  22. fire: (rpcname:string, ...args: any[]) => Promise<any>
  23. on: T.OnFunction
  24. close() : void
  25. }
  26. export interface Destroyable{
  27. destroy() : void
  28. }