Skip to content

Commit cf60c6b

Browse files
mrbrianevansjuanarbol
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 89e5ac9 commit cf60c6b

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
@@ -1478,9 +1478,9 @@ require manual async tracking. Specifically, all events emitted by instances
14781478
of `events.EventEmitterAsyncResource` will run within its [async context][].
14791479

14801480
```mjs
1481-
import { EventEmitterAsyncResource } from 'node:events';
1481+
import { EventEmitterAsyncResource, EventEmitter } from 'node:events';
14821482
import { notStrictEqual, strictEqual } from 'node:assert';
1483-
import { executionAsyncId } from 'node:async_hooks';
1483+
import { executionAsyncId, triggerAsyncId } from 'node:async_hooks';
14841484

14851485
// Async tracking tooling will identify this as 'Q'.
14861486
const ee1 = new EventEmitterAsyncResource({ name: 'Q' });
@@ -1507,9 +1507,9 @@ Promise.resolve().then(() => {
15071507
```
15081508

15091509
```cjs
1510-
const { EventEmitterAsyncResource } = require('node:events');
1510+
const { EventEmitterAsyncResource, EventEmitter } = require('node:events');
15111511
const { notStrictEqual, strictEqual } = require('node:assert');
1512-
const { executionAsyncId } = require('node:async_hooks');
1512+
const { executionAsyncId, triggerAsyncId } = require('node:async_hooks');
15131513

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

0 commit comments

Comments
 (0)