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

123456789101112131415161718192021222324
  1. import * as T from "./Types";
  2. /**
  3. * Interface for all classes that export RPCs
  4. */
  5. export type RPCExporter<
  6. Ifc extends T.RPCInterface = T.RPCInterface,
  7. Name extends keyof Ifc = keyof Ifc,
  8. > = {
  9. name: Name
  10. RPCs : T.RPCDefinitions<Ifc>[Name] | (() => T.RPCDefinitions<Ifc>[Name])
  11. }
  12. export interface Socket {
  13. id?: string
  14. bind: (name: string, listener: T.PioBindListener) => void
  15. hook: (rpcname: string, handler: T.PioHookListener) => void
  16. unhook: (rpcname: string, listener?:T.GenericFunction) => void
  17. call: (rpcname: string, ...args: any[]) => Promise<any>
  18. fire: (rpcname: string, ...args: any[]) => Promise<any>
  19. on: (type: string, f: T.GenericFunction)=>any
  20. emit: (eventName: string, ...args: any[]) => void
  21. close(): void
  22. }