Class

PropagatingEventEmitter

dcp/dcp-events#PropagatingEventEmitter()

An EventEmitter which invokes event handlers in last-in first-out order. If any handler returns false it stops invoking handlers for this event.

Constructor

# new PropagatingEventEmitter()

Extends

Methods

# addEventListener()

Alias of addListener.

Overrides:

# addListener(eventName, eventHandler)

Add an event listener.

Parameters:
Name Type Description
eventName string

The name of the event to capture, or true to capture all events

eventHandler function

The function to invoke when the eventHandler is invoked. The arguments to the function are specified by the code emitting the event, however a final argument, eventName, is appended to event handlers invoked via catch-alls.

Overrides:

# emit(eventName)

Emit an event.

Parameters:
Name Type Description
eventName string

The event to emit

...

Any other arguments passed will be passed exactly to the listener.

Overrides:

# once(eventName, eventHandler)

Attach a callback (eventHandler) to a named event. It will be called once when this event emitter emits that event and then removed.

Parameters:
Name Type Description
eventName string

Name of event

eventHandler function

Function to call

Overrides:

# removeEventListener()

Alias of removeListener.

Overrides:

# removeListener(eventName, eventHandler)

Remove a listener (eventHandler) attached to a named event. It must be the same eventHandler instance that was originally attached.

Parameters:
Name Type Description
eventName string

Name of event

eventHandler function

Function to call

Overrides: