From 755b89772d1fd5d3abd7ddabc51215096a9a9592 Mon Sep 17 00:00:00 2001 From: Ivo Janssen Date: Wed, 9 Oct 2024 00:32:00 -0700 Subject: [PATCH] doc: fix `events.once()` example using `AbortSignal` PR-URL: https://github.com/nodejs/node/pull/55144 Reviewed-By: James M Snell Reviewed-By: Jake Yuesong Li --- doc/api/events.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/doc/api/events.md b/doc/api/events.md index b9c052120cc88a..f3292841bb1230 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -1459,8 +1459,7 @@ async function foo(emitter, event, signal) { } foo(ee, 'foo', ac.signal); -ac.abort(); // Abort waiting for the event -ee.emit('foo'); // Prints: Waiting for the event was canceled! +ac.abort(); // Prints: Waiting for the event was canceled! ``` ```cjs @@ -1483,8 +1482,7 @@ async function foo(emitter, event, signal) { } foo(ee, 'foo', ac.signal); -ac.abort(); // Abort waiting for the event -ee.emit('foo'); // Prints: Waiting for the event was canceled! +ac.abort(); // Prints: Waiting for the event was canceled! ``` ### Awaiting multiple events emitted on `process.nextTick()`