Skip to content

Commit

Permalink
doc(events): fix once() example using AbortSignal
Browse files Browse the repository at this point in the history
  • Loading branch information
foxxyz committed Sep 27, 2024
1 parent 1398c04 commit d729dab
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 @@ -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
Expand All @@ -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()`
Expand Down

0 comments on commit d729dab

Please sign in to comment.