Like an EventEmitter, instances of this class allow us register and unregister listeners for events, but it allows listening for those messages that match a pattern.

Example

let x = new Emitter();
x.addContentListener({foo: 'bar'}, (data) => {
console.log('received data', data);
});
x.emit({foo: 'bar', hello: 'world'})

> received data {foo: 'bar', hello: 'world'}

Hierarchy

Constructors

Properties

address: string
callTransfer: CallTransferAPI
dependencies: Dependencies = {}
invites: InvitesAPI
pending: Record<string, PendingRequest> = {}
pendingWithInviteId: Map<any, any> = ...
pingTimer: number = 0
register: RegisterAPI
rooms: RoomsAPI
socket: null | default = null

Accessors

Methods

  • Add an event listener that will be called when an event that matches provided filter is received

    Parameters

    • filter: {
          cancel?: string;
          payload?: any;
          request?: string;
      }

      filter that should match emited events to call provided function

      • Optional cancel?: string
      • Optional payload?: any
      • Optional request?: string
    • fn: ((...args: string[]) => void)

      callback to invoke on each new match.

        • (...args: string[]): void
        • Parameters

          • Rest ...args: string[]

          Returns void

    Returns void

  • Stop receiving events on a previously added listener.

    Parameters

    • fn: ((...args: string[]) => void)

      callback to remove from listeners list.

        • (...args: string[]): void
        • Parameters

          • Rest ...args: string[]

          Returns void

    Returns void

Generated using TypeDoc