Skip to content

Commit

Permalink
stream: avoid usage of deprecated APIs
Browse files Browse the repository at this point in the history
Avoid usage of the `events.listenerCount()` method as it is
deprecated.

PR-URL: #41871
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Mestery <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
  • Loading branch information
VoltrexKeyva authored and nodejs-github-bot committed Feb 11, 2022
1 parent 717de17 commit 849fb70
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/internal/streams/readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
debug('onerror', er);
unpipe();
dest.removeListener('error', onerror);
if (EE.listenerCount(dest, 'error') === 0) {
if (dest.listenerCount('error') === 0) {
const s = dest._writableState || dest._readableState;
if (s && !s.errorEmitted) {
// User incorrectly emitted 'error' directly on the stream.
Expand Down Expand Up @@ -852,7 +852,7 @@ function pipeOnDrain(src, dest) {
}

if ((!state.awaitDrainWriters || state.awaitDrainWriters.size === 0) &&
EE.listenerCount(src, 'data')) {
src.listenerCount('data')) {
src.resume();
}
};
Expand Down

0 comments on commit 849fb70

Please sign in to comment.