mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
events: deprecate static listenerCount function
As per the discussion in #734, this patch deprecates the usage of `EventEmitter.listenerCount` static function in the docs, and introduces the `listenerCount` function in the prototype of `EventEmitter` itself. PR-URL: https://github.com/nodejs/node/pull/2349 Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
This commit is contained in:
1 parent
8576324cea
commit
3e6a6fcdd6
13 files changed
+56
-30
No files matched your search
+1
-2
@@ -802,8 +802,7 @@
|
||||
});
|
||||
|
||||
process.on('removeListener', function(type, listener) {
|
||||
if (signalWraps.hasOwnProperty(type) &&
|
||||
NativeModule.require('events').listenerCount(this, type) === 0) {
|
||||
if (signalWraps.hasOwnProperty(type) && this.listenerCount(type) === 0) {
|
||||
signalWraps[type].close();
|
||||
delete signalWraps[type];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user