Skip to content

Commit

Permalink
doc: fix events.once() example using AbortSignal
Browse files Browse the repository at this point in the history
PR-URL: #55144
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Jake Yuesong Li <[email protected]>
  • Loading branch information
foxxyz authored and marco-ippolito committed Nov 17, 2024
1 parent 748ed2e commit b963db9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions doc/api/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()`
Expand Down

0 comments on commit b963db9

Please sign in to comment.