Events as promised
An EventEmitter
that's full of Promise
!
Augment EventEmitter
to handle asynchronous listeners by using
a promise-returning emit()
method. All listeners are executed serially,
casting the return value to a Promise
via Promise.resolve()
.
If a promise is rejected, or an error is thrown when executing the listener,
the iteration stops and the resulting promise is rejected.
Usage
var Events = ;var events = ;events;events;events;events; events; // Will print// First listener// Second listener// Third listener// Foo error
Promise
No native Falls back to bluebird
if no native Promise
is found.