1.0.0 • Published 9 years ago
event-promise v1.0.0
event-promise
promises for events
usage
once(emitter, event, options)emitterEventEmittereventstringoptionsobject- 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
ignoreErrorsboolean
by default, the promise will reject if emitter emits an error first. Set this
to true if you want to handle errors yourself.
arrayboolean
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