What I'm considering for an async event emitter is a situation like this:
- I want to be able to fire events before something happens and after something happens.
- Each of the event handlers may do an async process.
- I need to know after all of the "before" event handlers have completed before doing the actual action that I'm saying will happen.
A synchronous example would look like:
emitter.emit('beforewrite');
doWrite();
emitter.emit('afterwrite');
The challenge is that the event handlers may all be doing async operations, so I need to wait until all of them have completed before doing the write operation.
Thoughts?
I've used none of these, but they might be interesting to look at it in more detail:
https://npmjs.org/package/strong-task-emitter
https://npmjs.org/package/event-emitter-grouped
https://npmjs.org/package/eventflow
https://npmjs.org/package/work