mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
readline: replace _questionCancel with a symbol
This commit avoids exposing a new underscored property on readline Interface instances. PR-URL: https://github.com/nodejs/node/pull/37094 Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
@@ -117,6 +117,7 @@ const kMincrlfDelay = 100;
|
||||
const lineEnding = /\r?\n|\r(?!\n)/;
|
||||
|
||||
const kLineObjectStream = Symbol('line object stream');
|
||||
const kQuestionCancel = Symbol('kQuestionCancel');
|
||||
|
||||
const KEYPRESS_DECODER = Symbol('keypress-decoder');
|
||||
const ESCAPE_DECODER = Symbol('escape-decoder');
|
||||
@@ -225,7 +226,7 @@ function Interface(input, output, completer, terminal) {
|
||||
};
|
||||
}
|
||||
|
||||
this._questionCancel = FunctionPrototypeBind(_questionCancel, this);
|
||||
this[kQuestionCancel] = FunctionPrototypeBind(_questionCancel, this);
|
||||
|
||||
this.setPrompt(prompt);
|
||||
|
||||
@@ -376,7 +377,7 @@ Interface.prototype.question = function(query, options, cb) {
|
||||
|
||||
if (options.signal) {
|
||||
options.signal.addEventListener('abort', () => {
|
||||
this._questionCancel();
|
||||
this[kQuestionCancel]();
|
||||
}, { once: true });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user