Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

Interfaces.ts 807B

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 type RPCExporter<
  7. Ifc extends T.RPCInterface = T.RPCInterface,
  8. Name extends keyof Ifc = string,
  9. > = {
  10. name: Name
  11. exportRPCs() : T.RPCDefinitions<Ifc>[Name]
  12. }
  13. /**
  14. * Generic socket interface that can apply to bsock as well as RPCSocket
  15. */
  16. export interface Socket extends Destroyable {
  17. port: number
  18. hook: (rpcname: string, handler: T.AnyFunction) => void
  19. unhook: (rpcname:string) => void
  20. call: (rpcname:string, ...args: any[]) => Promise<any>
  21. fire: (rpcname:string, ...args: any[]) => Promise<any>
  22. on: T.OnFunction
  23. emit: (eventName: string, data:any) => void
  24. close() : void
  25. }
  26. export interface Destroyable{
  27. destroy() : void
  28. }