GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — lib: add missing type of removeEventListener in question · nodejs/node@1ff8f68

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • readline.js
  • test/parallel
    • test-readline-interface.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/readline.js‎

Copy file name to clipboardExpand all lines: lib/readline.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Interface.prototype.question = function(query, options, cb) {
146146
};
147147
options.signal.addEventListener('abort', onAbort, { once: true });
148148
const cleanup = () => {
149-
options.signal.removeEventListener(onAbort);
149+
options.signal.removeEventListener('abort', onAbort);
150150
};
151151
const originalCb = cb;
152152
cb = typeof cb === 'function' ? (answer) => {
Collapse file

‎test/parallel/test-readline-interface.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-readline-interface.js
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,24 @@ for (let i = 0; i < 12; i++) {
921921
fi.emit('data', 'asdf\n');
922922
}
923923

924+
// Ensure that options.signal.removeEventListener was called
925+
{
926+
const ac = new AbortController();
927+
const signal = ac.signal;
928+
const [rli] = getInterface({ terminal });
929+
signal.removeEventListener = common.mustCall(
930+
(event, onAbortFn) => {
931+
assert.strictEqual(event, 'abort');
932+
assert.strictEqual(onAbortFn.name, 'onAbort');
933+
});
934+
935+
rli.question('hello?', { signal }, common.mustCall());
936+
937+
rli.write('bar\n');
938+
ac.abort();
939+
rli.close();
940+
}
941+
924942
// Sending a blank line
925943
{
926944
const [rli, fi] = getInterface({ terminal });

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.