events: define properties on prototype

Speeds up EventEmitter object construction by about 15-20%.
pull/37258/head
Ryunosuke SATO 2013-05-26 05:03:02 +09:00 committed by Ben Noordhuis
parent 6af8788f3e
commit 7ce5a31061
1 changed files with 3 additions and 0 deletions

View File

@ -37,6 +37,9 @@ function EventEmitter() {
}
exports.EventEmitter = EventEmitter;
EventEmitter.prototype.domain = undefined;
EventEmitter.prototype._events = undefined;
EventEmitter.prototype._maxListeners = undefined;
// By default EventEmitters will print a warning if more than 10 listeners are
// added to it. This is a useful default which helps finding memory leaks.