Socket
Socket
Sign inDemoInstall

eventemitter3

Package Overview
Dependencies
4
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.1.2

benchmarks/run/hundereds.js

6

index.js

@@ -43,2 +43,4 @@ 'use strict';

if (1 === length) {
if (fn.__EE3_once) this.removeListener(event, fn);
switch (len) {

@@ -71,4 +73,2 @@ case 1:

}
if (fn.__EE3_once) this.removeListener(event, fn);
} else {

@@ -80,4 +80,4 @@ for (i = 1, args = new Array(len -1); i < len; i++) {

for (i = 0; i < length; fn = listeners[++i]) {
if (fn.__EE3_once) this.removeListener(event, fn);
fn.apply(fn.__EE3_context || this, args);
if (fn.__EE3_once) this.removeListener(event, fn);
}

@@ -84,0 +84,0 @@ }

{
"name": "eventemitter3",
"version": "0.1.1",
"version": "0.1.2",
"description": "EventEmitter3 focuses on performance while maintaining a Node.js AND browser compatible interface. This the source of the same EventEmitter that is used in Primus.",

@@ -20,4 +20,8 @@ "main": "index.js",

"pub/sub",
"publish",
"subscribe",
"event",
"emitter"
"emitter",
"addListener",
"addEventListener"
],

@@ -30,6 +34,6 @@ "author": "Arnout Kazemier",

"devDependencies": {
"mocha": "1.13.x",
"mocha": "1.18.x",
"pre-commit": "0.0.x",
"chai": "1.8.x"
"chai": "1.9.x"
}
}

@@ -125,2 +125,16 @@ 'use strict';

it('only emits once if emits are nested inside the listener', function () {
var e = new EventEmitter()
, calls = 0;
e.once('foo', function () {
calls++;
e.emit('foo');
});
e.emit('foo');
expect(e.listeners('foo').length).to.equal(0);
expect(calls).to.equal(1);
});
it('only emits once for multiple events', function () {

@@ -127,0 +141,0 @@ var e = new EventEmitter()

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc