Created
April 11, 2017 16:29
-
-
Save jblebrun/5b43760dc144532e444e1e7af03dcab1 to your computer and use it in GitHub Desktop.
EventEmitter in node.js master, April 2017
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function EventEmitter() { | |
EventEmitter.init.call(this); | |
} | |
/*...*/ | |
EventEmitter.init = function() { | |
this.domain = null; | |
if (EventEmitter.usingDomains) { | |
// if there is an active domain, then attach to it. | |
domain = domain || require('domain'); | |
if (domain.active && !(this instanceof domain.Domain)) { | |
this.domain = domain.active; | |
} | |
} | |
if (!this._events || this._events === Object.getPrototypeOf(this)._events) { | |
this._events = Object.create(null); | |
this._eventsCount = 0; | |
} | |
this._maxListeners = this._maxListeners || undefined; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment