1.0.0 • Published 8 years ago
then-events v1.0.0
Node Asynchronous EventEmitter
This is an EventEmitter
for NodeJS which works with event listeners which
have an awaitable return type. The emit-function is tuned to return a promise
which is resolved as soon as all callbacks have finished.
npm i --save then-events
import { AsyncEventEmitter } from "then-events"
const emitter = new AsyncEventEmitter()
emitter.on('foo', () => {
return new Promise(accept => {
setTimeout(accept, 100)
})
})
emitter.emit('foo').then(() => {
console.log('it is done.')
})
1.0.0
8 years ago