pubsub.d.ts 557 B

123456789101112131415
  1. /// <reference types="node" />
  2. import { EventEmitter } from 'events';
  3. import { PubSubEngine } from './pubsub-engine';
  4. export interface PubSubOptions {
  5. eventEmitter?: EventEmitter;
  6. }
  7. export declare class PubSub extends PubSubEngine {
  8. protected ee: EventEmitter;
  9. private subscriptions;
  10. private subIdCounter;
  11. constructor(options?: PubSubOptions);
  12. publish(triggerName: string, payload: any): Promise<void>;
  13. subscribe(triggerName: string, onMessage: (...args: any[]) => void): Promise<number>;
  14. unsubscribe(subId: number): void;
  15. }