events: use assigned variable instead of arguments
authorRyunosuke SATO <tricknotes.rs@gmail.com>
Mon, 10 Dec 2012 09:07:23 +0000 (18:07 +0900)
committerBen Noordhuis <info@bnoordhuis.nl>
Mon, 10 Dec 2012 12:04:46 +0000 (13:04 +0100)
Always `arguments[0]` is used when `EventEmitter#emit` called.
Using assigned variable is faster than `arguments[0]`.

lib/events.js

index fc933c5..00c2071 100644 (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 ||