Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cf60c6b

Browse filesBrowse 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 <mohammadkeyvanzade94@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
1 parent 89e5ac9 commit cf60c6b
Copy full SHA for cf60c6b

File tree

Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Open diff view settings
Collapse file

‎doc/api/events.md‎

Copy file name to clipboardExpand all lines: doc/api/events.md
+4-4Lines changed: 4 additions & 4 deletions
  • Display the source diff
  • Display the rich diff
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.