From b963db9ee2332f4d3daa32b18f85bfeee3c11f05 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 b0be1d9b8499b8..329d763b87065d 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -1455,8 +1455,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 @@ -1479,8 +1478,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()`