Socket
Socket
Sign inDemoInstall

event-promise

Package Overview
Dependencies
2
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    event-promise

promises for events


Version published
Maintainers
1
Created

Readme

Source

event-promise

promises for events

usage

once(emitter, event, options)
  • emitter EventEmitter
  • event string
  • options object
  • Returns: promise

example

var once = require('node-event-promise');
var http = require('http');

var request = http.get('http://duckduckgo.com/');

once(request, 'response').then(function(response) {
  // ...
}, function(error) {
  // ...
}).done();

options

  • ignoreErrors boolean

by default, the promise will reject if emitter emits an error first. Set this to true if you want to handle errors yourself.

  • array boolean

if array is true, the promise will resolve to an array of all arguments passed to the event instead of just the first argument. This is only useful if the event is fired with more than one argument, e.g. FSWatcher::change

Keywords

FAQs

Last updated on 28 Jul 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc