npm

Don't miss out on this year's npm Pride t-shirt designs!Order your favorites here »

This package has been deprecated

Author message:

This package has been deprecated

once-promised

1.1.0 • Public • Published

once-promised

| Create a promise for an event, once

usage

import oncePromised from 'once-promised'
const emitter = new EventEmitter()
 
const promise = oncePromised(emitter, 'test')
 
promise.then(arg => {
  console.log('The event fired!')
  console.log('the argument was:', arg)
  // => the argument was an argument
})
 
emitter.emit('test', 'an argument')

It is also possible to pass an alternative promise implementation in as a third argument it will be called with new

Keywords

none

install

npm i once-promised

Downloadsweekly downloads

7

version

1.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability