Skip to content

EventEmitter.getGroupedListenerList

Dragiyski edited this page Mar 28, 2015 · 2 revisions

Returns the listeners for specified event in topologically sorted groups. That the same order in which emit method would execute them.

Usage

emitter.getGroupedListenerList(event);

Arguments

Argument Type Required Description
event string The name of the event.

Return

Returns an array containing arrays containing listener functions.

Exceptions

  • The method throws ReferenceError if current graph is not dependency graph, e.g. it has cycles. To distinguish between ReferenceError thrown by bug and intentionally, intentional ReferenceError will have code equal to CIRCULAR_REFERENCE string.

Remarks

The returned array contains array we call groups. Each group is an array, but the order within the inner array is implementation specific and irrelevant. All the listeners in the first group can be called in any order, and if someone in the group returns a promise, the others in the group may not wait that promise to resolve. However all returned promises from the first group should be resolved before call listener functions from the second group.

Clone this wiki locally