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 <jasnell@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
  • Loading branch information
foxxyz authored Oct 9, 2024
1 parent 1d38bd1 commit 755b897
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 755b897

Please sign in to comment.