events: use assigned variable instead of arguments

Always `arguments[0]` is used when `EventEmitter#emit` called.
Using assigned variable is faster than `arguments[0]`.
This commit is contained in:
Ryunosuke SATO 2012-12-10 18:07:23 +09:00 committed by Ben Noordhuis
parent 0397223ab4
commit 1c7acd2c84

View File

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