Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b03272b

Browse filesBrowse files
foxxyzaduh95
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 c9a1bbb commit b03272b
Copy full SHA for b03272b

File tree

Expand file treeCollapse file tree

1 file changed

+2
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-4
lines changed
Open diff view settings
Collapse file

‎doc/api/events.md‎

Copy file name to clipboardExpand all lines: doc/api/events.md
+2-4Lines changed: 2 additions & 4 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1459,8 +1459,7 @@ async function foo(emitter, event, signal) {
14591459
}
14601460

14611461
foo(ee, 'foo', ac.signal);
1462-
ac.abort(); // Abort waiting for the event
1463-
ee.emit('foo'); // Prints: Waiting for the event was canceled!
1462+
ac.abort(); // Prints: Waiting for the event was canceled!
14641463
```
14651464

14661465
```cjs
@@ -1483,8 +1482,7 @@ async function foo(emitter, event, signal) {
14831482
}
14841483

14851484
foo(ee, 'foo', ac.signal);
1486-
ac.abort(); // Abort waiting for the event
1487-
ee.emit('foo'); // Prints: Waiting for the event was canceled!
1485+
ac.abort(); // Prints: Waiting for the event was canceled!
14881486
```
14891487

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.