| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 362d832 commit 9f8eddb
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,20 @@ EventEmitter.prototype._maxListeners = undefined; | |||
| 19 | 19 | ||
| 20 | 20 | // By default EventEmitters will print a warning if more than 10 listeners are | |
| 21 | 21 | // added to it. This is a useful default which helps finding memory leaks. | |
| 22 | - EventEmitter.defaultMaxListeners = 10; | ||
| 22 | + var defaultMaxListeners = 10; | ||
| 23 | + | ||
| 24 | + Object.defineProperty(EventEmitter, 'defaultMaxListeners', { | ||
| 25 | + enumerable: true, | ||
| 26 | + get: function() { | ||
| 27 | + return defaultMaxListeners; | ||
| 28 | + }, | ||
| 29 | + set: function(arg) { | ||
| 30 | + // force global console to be compiled. | ||
| 31 | + // see https://github.com/nodejs/node/issues/4467 | ||
| 32 | + console; | ||
| 33 | + defaultMaxListeners = arg; | ||
| 34 | + } | ||
| 35 | + }); | ||
| 23 | 36 | ||
| 24 | 37 | EventEmitter.init = function() { | |
| 25 | 38 | this.domain = null; | |
@@ -240,8 +253,7 @@ EventEmitter.prototype.addListener = function addListener(type, listener) { | |||
| 240 | 253 | 'leak detected. %d %s listeners added. ' + | |
| 241 | 254 | 'Use emitter.setMaxListeners() to increase limit.', | |
| 242 | 255 | existing.length, type); | |
| 243 | - if (console.trace) | ||
| 244 | - console.trace(); | ||
| 256 | + console.trace(); | ||
| 245 | 257 | } | |
| 246 | 258 | } | |
| 247 | 259 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,8 +25,7 @@ exports.error = function(msg) { | |||
| 25 | 25 | args[0] = fmt; | |
| 26 | 26 | for (let i = 1; i < arguments.length; ++i) | |
| 27 | 27 | args[i] = arguments[i]; | |
| 28 | - if (console.error) | ||
| 29 | - console.error.apply(console, args); | ||
| 28 | + console.error.apply(console, args); | ||
| 30 | 29 | } else { | |
| 31 | 30 | console.error(fmt); | |
| 32 | 31 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments