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 (view full)

Constructors

Properties

address: string
callTransfer: CallTransferAPI
dependencies: Dependencies = {}
invites: InvitesAPI
pending: Record<string, PendingRequest> = {}
pendingWithInviteId: Map<any, any> = ...
pingTimer: undefined | Timeout
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) => void)

      callback to invoke on each new match.

        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void