Creates a new Emitter instance
The AdonisJS application instance
Returns a map of events and their registered listeners. The map key is the event name and the value is another map of listeners.
The listeners map key is the original binding listener and the value is a callback function.
The events listeners map
Register a global error handler
The error handler callback
The emitter instance for method chaining
Bind multiple listeners to listen for a single event. The listen method is a convenience helper to be used with class based events and listeners.
The event class to listen for
Array of listener classes with handle methods
Listen for an event. The method returns the unsubscribe function.
The event to listen for
The listener to register
The unsubscribe function
Listen for an event. The method returns the unsubscribe function.
The event to listen for
The listener to register
The unsubscribe function
Listen for an event depending on a condition
The condition to check before listening
The event to listen for
The listener to register
The unsubscribe function
Listen for an event depending on a condition
The condition to check before listening
The event to listen for
The listener to register
The unsubscribe function
Listen for an event only once
The event to listen for
The listener to register
Listen for an event only once
The event to listen for
The listener to register
Attach a listener to listen for all the events. Wildcard listeners can only be defined as inline callbacks.
The wildcard listener callback
The unsubscribe function
Emit event. The event listeners will be called asynchronously in parallel.
You can await this method to wait for events listeners to finish
Emit event. The event listeners will be called asynchronously in parallel.
You can await this method to wait for events listeners to finish
The event to emit
The data to pass to listeners
Emit events serially. The event listeners will be called asynchronously in the same sequence as they are registered.
You can await this method to wait for events listeners to finish
Emit events serially. The event listeners will be called asynchronously in the same sequence as they are registered.
You can await this method to wait for events listeners to finish
The event to emit
The data to pass to listeners
Remove a specific listener for an event
The event to remove listener from
The listener to remove
Remove a specific listener listening for all the events
The wildcard listener to remove
The emitter instance for method chaining
Remove a specific listener for an event
The event to remove listener from
The listener to remove
Clear all listeners for a specific event
The event to clear listeners for
Clear all listeners for all the events
Get count of listeners for a given event or all the events
Optionalevent: Constructor<any> | keyof EventsListThe event to count listeners for (optional)
The number of listeners
Find if an event has one or more listeners
Optionalevent: Constructor<any> | keyof EventsListThe event to check listeners for (optional)
True if the event has listeners
Fake one or more events. The listeners for faked events will not be invoked.
The return value is an events buffer that collects all the events within memory.
Calling this method one than once drops the existing fakes and creates new one.
Optionalevents: (Constructor<any> | keyof EventsList)[]Array of events to fake (optional, defaults to all events)
The events buffer for assertions
Restore fakes
Event emitter is built on top of emittery with support class based events and listeners