mirror of https://github.com/nodejs/node.git
event: make setMaxListeners() return this
setMaxListeners was the only EventEmitter method that returned undefined, so could not be chained.pull/5010/head
parent
43951d7cfb
commit
f8d81222e8
|
@ -80,6 +80,7 @@ added for a particular event. This is a useful default which helps finding
|
||||||
memory leaks. Obviously not all Emitters should be limited to 10. This function
|
memory leaks. Obviously not all Emitters should be limited to 10. This function
|
||||||
allows that to be increased. Set to zero for unlimited.
|
allows that to be increased. Set to zero for unlimited.
|
||||||
|
|
||||||
|
Returns emitter, so calls can be chained.
|
||||||
|
|
||||||
### EventEmitter.defaultMaxListeners
|
### EventEmitter.defaultMaxListeners
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ EventEmitter.prototype.setMaxListeners = function(n) {
|
||||||
if (typeof n !== 'number' || n < 0)
|
if (typeof n !== 'number' || n < 0)
|
||||||
throw TypeError('n must be a positive number');
|
throw TypeError('n must be a positive number');
|
||||||
this._maxListeners = n;
|
this._maxListeners = n;
|
||||||
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
EventEmitter.prototype.emit = function(type) {
|
EventEmitter.prototype.emit = function(type) {
|
||||||
|
|
Loading…
Reference in New Issue