diff options
author | Sakthipriyan Vairamani <thechargingvolcano@gmail.com> | 2015-08-12 00:01:50 +0530 |
---|---|---|
committer | Sakthipriyan Vairamani <thechargingvolcano@gmail.com> | 2015-08-20 03:17:08 +0530 |
commit | 8f58fb92fff904a6ca58fd0df9ee5a1816e5b84e (patch) | |
tree | a3eb0aea4cfa4d7f3cbb85adefe60ca621901f89 /lib/readline.js | |
parent | d98eed51f782ea44c3fd7823b2912f7fb30ab185 (diff) | |
download | android-node-v8-8f58fb92fff904a6ca58fd0df9ee5a1816e5b84e.tar.gz android-node-v8-8f58fb92fff904a6ca58fd0df9ee5a1816e5b84e.tar.bz2 android-node-v8-8f58fb92fff904a6ca58fd0df9ee5a1816e5b84e.zip |
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>
Diffstat (limited to 'lib/readline.js')
-rw-r--r-- | lib/readline.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/readline.js b/lib/readline.js index 02fa9d08f6..6164bcc85f 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -683,7 +683,7 @@ Interface.prototype._ttyWrite = function(s, key) { switch (key.name) { case 'c': - if (EventEmitter.listenerCount(this, 'SIGINT') > 0) { + if (this.listenerCount('SIGINT') > 0) { this.emit('SIGINT'); } else { // This readline instance is finished @@ -746,7 +746,7 @@ Interface.prototype._ttyWrite = function(s, key) { case 'z': if (process.platform == 'win32') break; - if (EventEmitter.listenerCount(this, 'SIGTSTP') > 0) { + if (this.listenerCount('SIGTSTP') > 0) { this.emit('SIGTSTP'); } else { process.once('SIGCONT', (function(self) { @@ -907,7 +907,7 @@ function emitKeypressEvents(stream) { stream[ESCAPE_DECODER].next(); function onData(b) { - if (EventEmitter.listenerCount(stream, 'keypress') > 0) { + if (stream.listenerCount('keypress') > 0) { var r = stream[KEYPRESS_DECODER].write(b); if (r) { for (var i = 0; i < r.length; i++) { @@ -936,7 +936,7 @@ function emitKeypressEvents(stream) { } } - if (EventEmitter.listenerCount(stream, 'keypress') > 0) { + if (stream.listenerCount('keypress') > 0) { stream.on('data', onData); } else { stream.on('newListener', onNewListener); |