Skip to content

Commit b963db9

Browse files
foxxyzmarco-ippolito
authored andcommitted
doc: fix events.once() example using AbortSignal
PR-URL: #55144 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
1 parent 748ed2e commit b963db9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

doc/api/events.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,8 +1455,7 @@ async function foo(emitter, event, signal) {
14551455
}
14561456

14571457
foo(ee, 'foo', ac.signal);
1458-
ac.abort(); // Abort waiting for the event
1459-
ee.emit('foo'); // Prints: Waiting for the event was canceled!
1458+
ac.abort(); // Prints: Waiting for the event was canceled!
14601459
```
14611460

14621461
```cjs
@@ -1479,8 +1478,7 @@ async function foo(emitter, event, signal) {
14791478
}
14801479

14811480
foo(ee, 'foo', ac.signal);
1482-
ac.abort(); // Abort waiting for the event
1483-
ee.emit('foo'); // Prints: Waiting for the event was canceled!
1481+
ac.abort(); // Prints: Waiting for the event was canceled!
14841482
```
14851483

14861484
### Awaiting multiple events emitted on `process.nextTick()`

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy