1.1.0 • Published 7 years ago

once-then v1.1.0

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

Installation

npm install --save once-then

Usage

const EventEmitter = require('events').EventEmitter;
const onceThen = require('once-then');

onceThen works with the NodeJS event emitter or any events implementation that has its once method backwards compatible with NodeJS events.

const emitter = new EventEmitter();

onceThen(emitter, 'myEventName').then(() => {
  //
});

emitter.emit('myEventName');

Register

Register onceThen on an object.

onceThen.register(EventEmitter.prototype);

const emitter = new EventEmitter();

emitter.onceThen('myEventName').then(() => {
  //
});

emitter.emit('myEventName');
1.1.0

7 years ago

1.0.0

7 years ago