asyncemit
The asyncemit
allows you to emit an event to an EventEmitter3 asynchronously.
Installation
The module is released in the public npm registry and can be installed using:
npm install --save asyncemit
Usage
To make this pattern work there are a couple of preconditions that need to be satisfied:
- The method should be added on either a class that inherits from the EventEmitter or on a new EventEmitter instance.
- The number of arguments expected by a listener function should match the
number of arguments passed to the
asyncemit
method excluding the event name.
See the following example:
var EventEmitter = asyncemit = ; var ee = ;eeasyncemit = asyncemit; //// The next `foo` listeners will not be executed until `next` is called.//ee; //// Still executed, but synchronously.//ee; ee;