Innovenergy_trunk/frontend/node_modules/promisify-event
Kim 085d7c68ba adding untracked frontend and typescript files 2023-02-21 07:27:20 +01:00
..
LICENSE adding untracked frontend and typescript files 2023-02-21 07:27:20 +01:00
README.md adding untracked frontend and typescript files 2023-02-21 07:27:20 +01:00
index.js adding untracked frontend and typescript files 2023-02-21 07:27:20 +01:00
package.json adding untracked frontend and typescript files 2023-02-21 07:27:20 +01:00

README.md

promisify-event

Build Status

Promisify EventEmitter's event.

Install

npm install promisify-event

Usage

const promisifyEvent = require('promisify-event');

// Promisify server's `listening` event:
promisify(server, `listening`).then(() => {
  // ...
});

// Promisify `error` event. `error` event always rejects the promise:
promisify(server, 'error').catch(() => {
  // ...
});

// Cancel event subscription and promise (it will be never fulfilled):
var listeningPromise = promisify(server, `listening`);

listeningPromise.cancel();

listeningPromise.then(() => {
  // Will never happen
});

Author

Ivan Nikulin (ifaaan@gmail.com)