eventemitter2
Advanced tools
Comparing version 0.2.6 to 0.2.7
@@ -282,22 +282,4 @@ ;!function(root, undefined) { | ||
} | ||
// ... | ||
if (currentNs === 'error' && name === 'error') { | ||
collectedErrors = true; | ||
} | ||
} | ||
// ... | ||
if (currentNs === 'error' && !collectedErrors && (!self._allListenerFn || self._allListenerFn.length === 0)) { | ||
// ... | ||
if (arguments[1] instanceof Error) { | ||
throw arguments[1]; | ||
} else { | ||
throw new Error("Uncaught, unspecified 'error' event."); | ||
} | ||
return invoked; | ||
} | ||
exploreNs.push(collectedNs); | ||
@@ -321,3 +303,4 @@ } | ||
// ... | ||
// following coreEE convention, only events called 'error' should throw | ||
// an actual Error if there are no error listeners registered | ||
if (event === 'error') { | ||
@@ -324,0 +307,0 @@ |
{ | ||
"name": "eventemitter2", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"description": "A Node.js event emitter implementation with namespaces, wildcards, TTL and browser support.", | ||
"keywords": ["event", "events", "emitter", "eventemitter"], | ||
"author": "hij1nx <hij1nx@nodejitsu.com> http://twitter.com/hij1nx", | ||
"maintainers": [ | ||
"hij1nx <hij1nx@nodejitsu.com>", | ||
"jameson <jameson@nodejitsu.com>" | ||
], | ||
"contributers": [ | ||
@@ -8,0 +12,0 @@ "Charlie Robbins <charlie@nodejitsu.com> http://twitter.com/indexzero", |
@@ -705,4 +705,5 @@ var basicEvents = require('nodeunit').testCase; | ||
catch (ex) { | ||
test.ok(ex instanceof Error, 'should be an Error'); | ||
test.ok(false, 'should not be an Error'); | ||
} | ||
test.ok(true, 'should not have thrown any Error'); | ||
@@ -713,4 +714,5 @@ try { | ||
catch (ex) { | ||
test.equal(error, ex, 'should have passed up the argument'); | ||
test.ok(error !== ex, 'should not have passed up the argument'); | ||
} | ||
test.ok(true, 'should not have thrown any Error'); | ||
@@ -717,0 +719,0 @@ emitter.on('error', function (event, err) { |
@@ -11,3 +11,3 @@ var testCase = require('nodeunit').testCase; | ||
console.time('EE_1'); | ||
console.time('EE_CORE'); | ||
for (var i = 0; i < len; i++) { | ||
@@ -29,3 +29,3 @@ for (var j = 0; j < len; j++){ | ||
console.timeEnd('EE_1'); | ||
console.timeEnd('EE_CORE'); | ||
test.expect(300); | ||
@@ -32,0 +32,0 @@ test.done(); |
@@ -1,39 +0,27 @@ | ||
var testCase = require('nodeunit').testCase; | ||
module.exports = testCase({ | ||
var EventEmitter2 = require('../../lib/em').EventEmitter2; | ||
var emitter = new EventEmitter2; | ||
'Add 10000 listener, emit 300 times' : function (test) { | ||
var totalIterations = 100000; | ||
var iterations = totalIterations; | ||
var names = []; | ||
var EventEmitter2 = require('../em').EventEmitter2; | ||
var emitter = new EventEmitter2; | ||
while(iterations--) { | ||
names[iterations] = Math.pow(2*10, Math.random()).toString().replace('.', ''); | ||
} | ||
var iterations = 100; | ||
var len = 10; | ||
iterations = totalIterations; | ||
console.time('EE2_2'); | ||
for (var i = 0; i < len; i++) { | ||
for (var j = 0; j < len; j++){ | ||
for (var k = 0; k < len; k++){ | ||
for (var l = 0; l < len; l++){ | ||
emitter.on([i,j,k,l].join('.'), function () { test.ok(true,'emit') }); | ||
} | ||
} | ||
} | ||
} | ||
console.time('EE2_New'); | ||
while (iterations--) { | ||
emitter.emit('1.8.6.3'); | ||
emitter.emit('5.2.9.1'); | ||
emitter.emit('9.5.3.8'); | ||
// emitter.emit('2.*.5'); | ||
// emitter.emit('7.3.*'); | ||
} | ||
while (iterations--) { | ||
emitter.on(names[iterations], function () { 1==1; }); | ||
} | ||
console.timeEnd('EE2_2'); | ||
test.expect(300); | ||
test.done(); | ||
} | ||
iterations = totalIterations; | ||
}); | ||
while (iterations--) { | ||
emitter.emit(names[iterations]); | ||
} | ||
console.timeEnd('EE2_New'); |
@@ -28,3 +28,3 @@ var basicEvents = require('nodeunit').testCase; | ||
if(typeof require !== 'undefined') { | ||
EventEmitter2 = require('../lib/ee2').EventEmitter2; | ||
EventEmitter2 = require('../lib/em').EventEmitter2; | ||
} | ||
@@ -31,0 +31,0 @@ else { |
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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
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
222190
48
6096
1