EventManager

Generic array hash table to store listener definitions events is a Map whose keys are event names values are the Set of listeners to be attached for that event

Constructor

new EventManager()

Methods

add(eventName, listener)

Parameters:
Name Type Description
eventName string
listener function

attach(emitter, config)

Attach all currently added events to the given emitter

Parameters:
Name Type Description
emitter EventEmitter
config Object

detach(emitter, events)

Remove all listeners for a given emitter or only those for the given events If no events are given it will remove all listeners from all events defined in this manager.

Warning: This will remove all listeners for a given event list, this includes listeners not in this manager but attached to the same event

Parameters:
Name Type Description
emitter EventEmitter
events string | iterable

Optional name or list of event names to remove listeners from

get(name) → {Set}

Fetch all listeners for a given event

Parameters:
Name Type Description
name string
Returns:
Set