Skip to content

Commit

Permalink
events: rename high & low watermark for consistency
Browse files Browse the repository at this point in the history
PR-URL: #52080
Fixes: #52078
Refs: #41276
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
atlowChemi authored and nodejs-github-bot committed Apr 5, 2024
1 parent ec15504 commit d619aab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -1053,8 +1053,8 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
* @param {{
* signal: AbortSignal;
* close?: string[];
* highWatermark?: number,
* lowWatermark?: number
* highWaterMark?: number,
* lowWaterMark?: number
* }} [options]
* @returns {AsyncIterator}
*/
Expand All @@ -1065,10 +1065,12 @@ function on(emitter, event, options = kEmptyObject) {
validateAbortSignal(signal, 'options.signal');
if (signal?.aborted)
throw new AbortError(undefined, { cause: signal?.reason });
const highWatermark = options.highWatermark ?? NumberMAX_SAFE_INTEGER;
validateInteger(highWatermark, 'options.highWatermark', 1);
const lowWatermark = options.lowWatermark ?? 1;
validateInteger(lowWatermark, 'options.lowWatermark', 1);
// Support both highWaterMark and highWatermark for backward compatibility
const highWatermark = options.highWaterMark ?? options.highWatermark ?? NumberMAX_SAFE_INTEGER;
validateInteger(highWatermark, 'options.highWaterMark', 1);
// Support both lowWaterMark and lowWatermark for backward compatibility
const lowWatermark = options.lowWaterMark ?? options.lowWatermark ?? 1;
validateInteger(lowWatermark, 'options.lowWaterMark', 1);

// Preparing controlling queues and variables
FixedQueue ??= require('internal/fixed_queue');
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/readline/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,7 @@ class Interface extends InterfaceConstructor {
this[kLineObjectStream] = EventEmitter.on(
this, 'line', {
close: ['close'],
highWatermark: 1024,
highWaterMark: 1024,
[kFirstEventParam]: true,
});
}
Expand Down

0 comments on commit d619aab

Please sign in to comment.