Class Emitter

Subset of node's Emitter class

Param

Optional logger instance. Must comply to the Console interface.

Hierarchy

Methods

  • Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments to each.

    Parameters

    • eventName: string

      The name of the event.

    • Rest ...args: any[]

    Returns boolean

    Returns true if the event had listeners, false otherwise.

  • Adds the listener function to the end of the listeners array for the event named eventName.

    Parameters

    • eventName: string

      The name of the event.

    • listener: Listener

      Listener fn that handles the evt.

    Returns Emitter

    The Emitter instance.

  • Adds a one time listener function for the event named eventName. The next time eventName is triggered, this listener is removed and then invoked.

    Parameters

    • eventName: string

      The name of the event.

    • listener: Listener

      Listener fn that handles the evt.

    Returns Emitter

    The Emitter instance.

  • Removes all listeners, or those of the specified eventName.

    Parameters

    • eventName: string

      The name of the event. Optional if omitted all listeners will be removed.

    Returns Emitter

    The Emitter instance.

  • Removes the specified listener from the listener array for the event named eventName.

    Parameters

    • eventName: string

      The name of the event.

    • listener: Listener

      Listener fn that handles the evt.

    Returns Emitter

    The Emitter instance.

Generated using TypeDoc