Options
Menu

Class ConvergenceEventEmitter<T>

The ConvergenceEventEmitter is an abstract base class for all classes that fire events and provide an event registration mechanism to consumers.

Type parameters

Hierarchy

Index

Methods

addListener

  • Adds a new event listener for the specified event. The class will ignore duplicate registrations of the same listener to the same event.

    Parameters

    • event: string

      The name of the event to add the listener for.

    • listener: ConvergenceEventListener<T>

      The listener callback to register.

    Returns ConvergenceEventEmitter<T>

    This object, in support of a fluent API.

events

  • events(): Observable<T>
  • Provides the events emitted by this object as an Observable stream.

    example
    
    eventEmitter.events()
      .filter(e => e.name === "myevent")
      .subscribe(e => console.log(e));
    

    Returns Observable<T>

    An Observable stream of all events emitted by this object.

off

  • Removes a single event listener for a specific event.

    Parameters

    • event: string

      The name of the event to remove the listener for.

    • listener: ConvergenceEventListener<T>

      The listener callback to unregister.

    Returns ConvergenceEventEmitter<T>

    This object, in support of a fluent API.

on

  • Adds a new event listener for the specified event. The class will ignore duplicate registrations of the same listener to the same event.

    Parameters

    • event: string

      The name of the event to add the listener for.

    • listener: ConvergenceEventListener<T>

      The listener callback to register.

    Returns ConvergenceEventEmitter<T>

    This object, in support of a fluent API.

once

  • Adds a single shot event listener for the specified event. The listener will be called the first time the specified event is fired after the event registration occurs, after which the registration will be removed and no further events will be passed to the listener.

    Parameters

    • event: string

      The name of the event to add the listener for.

    • listener: ConvergenceEventListener<T>

      The listener callback to register.

    Returns ConvergenceEventEmitter<T>

    This object, in support of a fluent API.

removeAllListeners

  • Removes all listeners for all events. This is useful for cleanup before disposing of this particular event emitter.

    Returns ConvergenceEventEmitter<T>

    This object, in support of a fluent API.

removeListener

  • Removes a single event listener for a specific event.

    Parameters

    • event: string

      The name of the event to remove the listener for.

    • listener: ConvergenceEventListener<T>

      The listener callback to unregister.

    Returns ConvergenceEventEmitter<T>

    This object, in support of a fluent API.

removeListeners

  • Removes all listeners bound on the given event.

    Parameters

    • event: string

      the name of the event to remove listeners for

    Returns ConvergenceEventEmitter<T>

    This object, in support of a fluent API.