Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ev

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ev - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

bench/0.0.4.json

2

bench/emit.js

@@ -9,3 +9,3 @@ #!/usr/bin/env node

var bench = require('visualbench')( EV.version + ':emit:' + listenersNum )
var bench = require('visualbench')( 'emit:' + listenersNum, EV.version )

@@ -12,0 +12,0 @@ function test () {

@@ -0,1 +1,7 @@

0.0.6 / 2012-03-08
==================
* Added stack trace to the 'Warning: undefined event...' message
* Mitigated performance regression due to scope setting
0.0.5 / 2012-03-07

@@ -2,0 +8,0 @@ ==================

@@ -79,6 +79,7 @@ var maxListeners = 10

console.error(
'Warning (EventEmitter): undefined event [%s]. ' +
'Define at EventEmitter instanciation for better performance.'
'Warning (EventEmitter): undefined event [%s]. '
+ 'Define at EventEmitter instanciation for better performance.'
, ev
)
console.trace()
}

@@ -109,5 +110,5 @@

console.error(
'Warning (EventEmitter): Possible EventEmitter memory ' +
'leak detected. %d listeners added to event %s. ' +
'Use emitter.setMaxListeners() to increase limit.'
'Warning (EventEmitter): Possible EventEmitter memory '
+ 'leak detected. %d listeners added to event %s. '
+ 'Use emitter.setMaxListeners() to increase limit.'
, n

@@ -129,32 +130,71 @@ , ev

// Additional listener, register it according to its # of arguments
switch ( this._ev_length[ev] ) {
case 0:
this._ev_emit[ev] = this[key] = function () {
fn.call(self)
handler.call(self)
}
break
case 1:
this._ev_emit[ev] = this[key] = function () {
fn.call(self, arguments[0])
handler.call(self, arguments[0])
}
break
case 2:
this._ev_emit[ev] = this[key] = function () {
fn.call(self, arguments[0], arguments[1])
handler.call(self, arguments[0], arguments[1])
}
break
case 3:
this._ev_emit[ev] = this[key] = function () {
fn.call(self, arguments[0], arguments[1], arguments[2])
handler.call(self, arguments[0], arguments[1], arguments[2])
}
break
default:
this._ev_emit[ev] = this[key] = function () {
fn.apply(self, arguments)
handler.apply(self, arguments)
}
if (n === 1) {
// fn = first handler
// handler = second handler
// -> need to apply the scope to both
switch ( this._ev_length[ev] ) {
case 0:
this._ev_emit[ev] = this[key] = function () {
fn.call(self)
handler.call(self)
}
break
case 1:
this._ev_emit[ev] = this[key] = function () {
fn.call(self, arguments[0])
handler.call(self, arguments[0])
}
break
case 2:
this._ev_emit[ev] = this[key] = function () {
fn.call(self, arguments[0], arguments[1])
handler.call(self, arguments[0], arguments[1])
}
break
case 3:
this._ev_emit[ev] = this[key] = function () {
fn.call(self, arguments[0], arguments[1], arguments[2])
handler.call(self, arguments[0], arguments[1], arguments[2])
}
break
default:
this._ev_emit[ev] = this[key] = function () {
fn.apply(self, arguments)
handler.apply(self, arguments)
}
}
} else {
// Scope already set for the handlers triggered by fn
// -> no need to set fn's scope
switch ( this._ev_length[ev] ) {
case 0:
this._ev_emit[ev] = this[key] = function () {
fn()
handler.call(self)
}
break
case 1:
this._ev_emit[ev] = this[key] = function () {
fn(arguments[0])
handler.call(self, arguments[0])
}
break
case 2:
this._ev_emit[ev] = this[key] = function () {
fn(arguments[0], arguments[1])
handler.call(self, arguments[0], arguments[1])
}
break
case 3:
this._ev_emit[ev] = this[key] = function () {
fn(arguments[0], arguments[1], arguments[2])
handler.call(self, arguments[0], arguments[1], arguments[2])
}
break
default:
this._ev_emit[ev] = this[key] = function () {
fn(arguments)
handler.apply(self, arguments)
}
}
}

@@ -161,0 +201,0 @@ return this

@@ -6,3 +6,3 @@ {

, "keywords": ["event","emitter","listener"]
, "version": "0.0.5"
, "version": "0.0.6"
, "homepage": "http://github.com/pierrec/node-ev"

@@ -9,0 +9,0 @@ , "repository": {

# TODO
* Performance regression 0.0.4 -> 0.0.5 caused by .call()
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc