0.3.2 • Published 8 years ago
wait-events v0.3.2
wait-events
Turn a complex event emitter into a simple Promise.
Install
npm install --save wait-events
Usage
waitEvents(emitter, ...successEvents , ...errorEvents ) => promise
Example:
import waitEvents from 'wait-events'
// ...
waitEvents(slack, [
'opened_rtm_connection',
'authenticated',
], [
'failed_authentication',
'ws_error',
'ws_close',
]).then(() => {
console.log('Slack client connected!')
}).catch((err) => {
console.error('Failed connecting to Slack')
console.error(err)
})
slack.start()
0.3.2
8 years ago