Browse Source

events: use assigned variable instead of arguments

Always `arguments[0]` is used when `EventEmitter#emit` called.
Using assigned variable is faster than `arguments[0]`.
v0.9.4-release
Ryunosuke SATO 12 years ago
committed by Ben Noordhuis
parent
commit
1c7acd2c84
  1. 3
      lib/events.js

3
lib/events.js

@ -48,8 +48,7 @@ EventEmitter.prototype.setMaxListeners = function(n) {
// non-global reference, for speed. // non-global reference, for speed.
var PROCESS; var PROCESS;
EventEmitter.prototype.emit = function() { EventEmitter.prototype.emit = function(type) {
var type = arguments[0];
// If there is no 'error' event listener then throw. // If there is no 'error' event listener then throw.
if (type === 'error') { if (type === 'error') {
if (!this._events || !this._events.error || if (!this._events || !this._events.error ||

Loading…
Cancel
Save