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

1234567891011121314151617181920212223242526
  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. exportRPCs() : 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. }