promisify-event-bind

0.1.0 • Public • Published

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

Package Sidebar

Install

npm i promisify-event-bind

Weekly Downloads

2

Version

0.1.0

License

ISC

Last publish

Collaborators

  • laggingreflex