Skip to content

Commit 71c8696

Browse files
mrbrianevansRafaelGSS
authored andcommitted
doc: add missing imports in events sample code
There were missing imports in the example for using `EventEmitterAsyncResource`, so I added them in both ESM and CJS. PR-URL: #44337 Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Kohei Ueno <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
1 parent 255e7fb commit 71c8696

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

doc/api/events.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1487,9 +1487,9 @@ require manual async tracking. Specifically, all events emitted by instances
14871487
of `events.EventEmitterAsyncResource` will run within its [async context][].
14881488

14891489
```mjs
1490-
import { EventEmitterAsyncResource } from 'node:events';
1490+
import { EventEmitterAsyncResource, EventEmitter } from 'node:events';
14911491
import { notStrictEqual, strictEqual } from 'node:assert';
1492-
import { executionAsyncId } from 'node:async_hooks';
1492+
import { executionAsyncId, triggerAsyncId } from 'node:async_hooks';
14931493

14941494
// Async tracking tooling will identify this as 'Q'.
14951495
const ee1 = new EventEmitterAsyncResource({ name: 'Q' });
@@ -1516,9 +1516,9 @@ Promise.resolve().then(() => {
15161516
```
15171517

15181518
```cjs
1519-
const { EventEmitterAsyncResource } = require('node:events');
1519+
const { EventEmitterAsyncResource, EventEmitter } = require('node:events');
15201520
const { notStrictEqual, strictEqual } = require('node:assert');
1521-
const { executionAsyncId } = require('node:async_hooks');
1521+
const { executionAsyncId, triggerAsyncId } = require('node:async_hooks');
15221522

15231523
// Async tracking tooling will identify this as 'Q'.
15241524
const ee1 = new EventEmitterAsyncResource({ name: 'Q' });

0 commit comments

Comments
 (0)