From 6bdc42cee7e7aa6884e0b91277ee038d755afb4c Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 15 Sep 2010 15:47:28 -0700 Subject: [PATCH] shorten some lines in events.js --- lib/events.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/events.js b/lib/events.js index 69cfc4f..a6923b1 100644 --- a/lib/events.js +++ b/lib/events.js @@ -1,8 +1,8 @@ -exports.EventEmitter = process.EventEmitter; +var EventEmitter = exports.EventEmitter = process.EventEmitter; var isArray = Array.isArray; -process.EventEmitter.prototype.emit = function (type) { +EventEmitter.prototype.emit = function (type) { // If there is no 'error' event listener then throw. if (type === 'error') { if (!this._events || !this._events.error || @@ -49,9 +49,9 @@ process.EventEmitter.prototype.emit = function (type) { } }; -// process.EventEmitter is defined in src/node_events.cc -// process.EventEmitter.prototype.emit() is also defined there. -process.EventEmitter.prototype.addListener = function (type, listener) { +// EventEmitter is defined in src/node_events.cc +// EventEmitter.prototype.emit() is also defined there. +EventEmitter.prototype.addListener = function (type, listener) { if ('function' !== typeof listener) { throw new Error('addListener only takes instances of Function'); } @@ -76,9 +76,9 @@ process.EventEmitter.prototype.addListener = function (type, listener) { return this; }; -process.EventEmitter.prototype.on = process.EventEmitter.prototype.addListener; +EventEmitter.prototype.on = EventEmitter.prototype.addListener; -process.EventEmitter.prototype.removeListener = function (type, listener) { +EventEmitter.prototype.removeListener = function (type, listener) { if ('function' !== typeof listener) { throw new Error('removeListener only takes instances of Function'); } @@ -101,13 +101,13 @@ process.EventEmitter.prototype.removeListener = function (type, listener) { return this; }; -process.EventEmitter.prototype.removeAllListeners = function (type) { +EventEmitter.prototype.removeAllListeners = function (type) { // does not use listeners(), so no side effect of creating _events[type] if (type && this._events && this._events[type]) this._events[type] = null; return this; }; -process.EventEmitter.prototype.listeners = function (type) { +EventEmitter.prototype.listeners = function (type) { if (!this._events) this._events = {}; if (!this._events[type]) this._events[type] = []; if (!isArray(this._events[type])) { -- 2.7.4