Comparing version 1.0.2 to 2.0.0
@@ -20,3 +20,3 @@ 'use strict'; | ||
listeners = (this._events || {})[event] || []; | ||
listeners = (this._events || {})['~'+ event] || []; | ||
if (listeners && !Array.isArray(listeners)) { | ||
@@ -23,0 +23,0 @@ listeners = [ listeners ]; |
{ | ||
"name": "asyncemit", | ||
"version": "1.0.2", | ||
"version": "2.0.0", | ||
"description": "Asynchronously emit event an event based on the arguments length.", | ||
@@ -33,3 +33,3 @@ "main": "index.js", | ||
"assume": "1.2.x", | ||
"eventemitter3": "0.1.x", | ||
"eventemitter3": "1.0.x", | ||
"istanbul": "0.3.x", | ||
@@ -36,0 +36,0 @@ "mocha": "2.2.x", |
@@ -17,9 +17,10 @@ # asyncemit | ||
To make this pattern work we have make a couple assumptions about the way this | ||
module is used: | ||
To make this pattern work there are a couple of preconditions that need to be | ||
satisfied: | ||
1. This method should be added on either a class that inherits from the | ||
1. The method should be added on either a class that inherits from the | ||
EventEmitter or on a new EventEmitter instance. | ||
2. The amount of arguments you pass is the same amount of arguments required for | ||
your event to be seen as async emitter. | ||
2. The number of arguments expected by a listener function should match the | ||
number of arguments passed to the `asyncemit` method excluding the event | ||
name. | ||
@@ -29,4 +30,4 @@ See the following example: | ||
```js | ||
var asyncemit = require('asyncemit') | ||
, EventEmitter = require('eventemitter3'); | ||
var EventEmitter = require('eventemitter3') | ||
, asyncemit = require('asyncemit'); | ||
@@ -37,6 +38,6 @@ var ee = new EventEmitter(); | ||
// | ||
// The next `foo` listeners will not be executed until this `next` is called. | ||
// The next `foo` listeners will not be executed until `next` is called. | ||
// | ||
ee.on('foo', function (arg, next) { | ||
// do things with arg? | ||
// Do things with arg? | ||
next(); | ||
@@ -46,3 +47,3 @@ }); | ||
// | ||
// Still executed, by sync | ||
// Still executed, but synchronously. | ||
// | ||
@@ -56,3 +57,3 @@ ee.on('foo', function (arg) { | ||
// The error argument will be set if one of the async listeners called the | ||
// `next` callback with an `error` arugment. | ||
// `next` callback with an `error` argument. | ||
// | ||
@@ -64,2 +65,2 @@ }); | ||
MIT | ||
[MIT](LICENSE) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61
5358
4
50