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.

12345678910111213141516171819202122232425
  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 = keyof Ifc,
  9. > = {
  10. name: Name
  11. RPCs : T.RPCDefinitions<Ifc>[Name] | (() => T.RPCDefinitions<Ifc>[Name])
  12. }
  13. export interface Socket {
  14. id?: string
  15. bind: (name: string, listener: T.PioBindListener) => void
  16. hook: (rpcname: string, handler: T.PioHookListener) => void
  17. unhook: (rpcname: string, listener?:T.AnyFunction) => void
  18. call: (rpcname: string, ...args: any[]) => Promise<any>
  19. fire: (rpcname: string, ...args: any[]) => Promise<any>
  20. on: (type: string, f: T.AnyFunction)=>any
  21. emit: (eventName: string, data: any) => void
  22. close(): void
  23. }