0.1.0 • Published 7 years ago

promisify-event-bind v0.1.0

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

promisify-event-bind

Bind promisify-event to all EventEmitter's .on methods

Install

npm install promisify-event-bind

Usage

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 => {...});