🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

chained-emitter

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chained-emitter - npm Package Compare versions

Comparing version

to
0.1.3

6

package.json
{
"name": "chained-emitter",
"version": "0.1.2",
"version": "0.1.3",
"description": "chained-emitter is a an implementation of the EventEmitter found in Node.js, based on EventEmitter2, but adding the ability to return a promise in an event handler.",

@@ -36,6 +36,6 @@ "keywords": [

"nodeunit": "*",
"benchmark": ">= 0.2.2"
"benchmark": ">= 1.0.0"
},
"dependencies": {
"bluebird": "^2.3.11"
"bluebird": "^2.9.26"
},

@@ -42,0 +42,0 @@ "engines": [

# ChainedEventEmitter
ChainedEventEmitter is a an implementation of the EventEmitter found in Node.js,
ChainedEventEmitter is a an implementation of the EventEmitter found in Node.js,
based on EventEmitter2, but adding the ability to return a promise in an event
handler, so that the next handler waits for the previous to finish before
handler, so that the next handler waits for the previous to finish before
firing. As well, `emit()` returns a promise that is fulfilled when all of the

@@ -17,5 +17,5 @@ handlers have fired.

- The constructor takes a configuration object.
```javascript
var ChainedEmitter = require('ChainedEmitter').EventEmitter;
var ChainedEmitter = reuire('ChainedEmitter').EventEmitter;
var server = new ChainedEmitter({

@@ -29,5 +29,5 @@ parallel: true, // fire second handler before the first resolves, defaults to false

```javascript
var q = require('q')
var bb = require('bluebird')
server.on('foo.*', function(value1, value2) {
return q.defer().promise
return bb.defer().promise
});

@@ -41,7 +41,7 @@ ```

Adds a listener to the end of the listeners array for the specified event. If
the listener returns a `Q` promise, the promise returned by `emit()` will not
Adds a listener to the end of the listeners array for the specified event. If
the listener returns a [bluebird](https://github.com/petkaantonov/bluebird) promise, the promise returned by `emit()` will not
resolve until the returned promise resolves. If the `parallel` configuration
is `false`, the next handler will also wait to fire before the returned promise
resolves. If you return anything but a promise (including `undefined` or
resolves. If you return anything but a promise (including `undefined` or
`null`), the next action will happen immediately.

@@ -51,3 +51,3 @@

server.on('data', function(value1, value2, value3 /* accepts any number of expected values... */) {
var me = q.defer();
var me = bb.defer();
return me.promise; // wait for me!

@@ -67,3 +67,3 @@ });

Copyright (c) 2011 hij1nx <http://www.twitter.com/hij1nx>
Copyright (c) 2011 hij1nx <http://www.twitter.com/hij1nx>
Copyright (c) 2013 hildjj <http://www.twitter.com/hildjj>

@@ -70,0 +70,0 @@