Private
listenersAdds a new listener. All listeners will be notified when an event is dispatched.
A listener function.
An unregister function. Sometimes it's easier to have a dedicated function to unregister than keeping the listener reference around
Emits a single event by notifying all registered listeners. Listeners are invoked one after the other synchronously. If an event listener throws an error processing stops and the error is propagated.
Data passed to all listeners.
Removes a previously registered listener. This is an alias for the removeListener
method named
like this to resemble the EventEmitter interface.
A listener function.
Adds a new listener. This is an alias for the addListener
method named
like this to resemble the EventEmitter interface.
A listener function.
An unregister function. Sometimes it's easier to have a dedicated function to unregister than keeping the listener reference around
Adds a listener that is automatically unregistered after the first execution.
A listener function.
An unregister function. Sometimes it's easier to have a dedicated function to unregister than keeping the listener reference around
Listeners are normally invoked in the order they were registered, this method allow to add a listener that is invoked before any other. The last listener prepended will always be the first one invoked.
A listener function.
An unregister function. Sometimes it's easier to have a dedicated function to unregister than keeping the listener reference around
Removes a previously registered listener.
A listener function.
Generated using TypeDoc
Alternative API to work with event driven tasks. I used to work with the EventEmitter api but this is a fairly old API that doesn't play too well with typescript. To overcome this limitation I decided to provide this new API, which resemble EventEmitter to some extend, and is inspired by the Angular 2+ EventEmitters. The idea is simple: for each event we create an instance of this class that will keep a list of listeners.
Example