0.1.0 • Published 9 years ago
promisify-event-bind v0.1.0
promisify-event-bind
Bind promisify-event to all EventEmitter's .on methods
Install
npm install promisify-event-bindUsage
const promisifyAll = require('promisify-event-bind');
promisifyAll(server);
server.on('listening').then(() => {
// ...
})Note that since this is a promise it can only be resolved once (which is what it does).
It's good for one-off events:
const socket = await io.on('connection');Not for events that'll fire multiple times with possibly different values:
socket.on('message', data => {...});0.1.0
9 years ago