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 709B

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