From 71c869688a62528ea60a41145d3d1821a9069034 Mon Sep 17 00:00:00 2001 From: Brian Evans <53117772+mrbrianevans@users.noreply.github.com> Date: Thu, 1 Sep 2022 00:59:15 +0100 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/44337 Reviewed-By: Mohammed Keyvanzadeh Reviewed-By: Luigi Pinca Reviewed-By: Kohei Ueno Reviewed-By: James M Snell Reviewed-By: Franziska Hinkelmann --- doc/api/events.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api/events.md b/doc/api/events.md index 28b6b31fa04c9a..c488694d8bef93 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -1487,9 +1487,9 @@ require manual async tracking. Specifically, all events emitted by instances of `events.EventEmitterAsyncResource` will run within its [async context][]. ```mjs -import { EventEmitterAsyncResource } from 'node:events'; +import { EventEmitterAsyncResource, EventEmitter } from 'node:events'; import { notStrictEqual, strictEqual } from 'node:assert'; -import { executionAsyncId } from 'node:async_hooks'; +import { executionAsyncId, triggerAsyncId } from 'node:async_hooks'; // Async tracking tooling will identify this as 'Q'. const ee1 = new EventEmitterAsyncResource({ name: 'Q' }); @@ -1516,9 +1516,9 @@ Promise.resolve().then(() => { ``` ```cjs -const { EventEmitterAsyncResource } = require('node:events'); +const { EventEmitterAsyncResource, EventEmitter } = require('node:events'); const { notStrictEqual, strictEqual } = require('node:assert'); -const { executionAsyncId } = require('node:async_hooks'); +const { executionAsyncId, triggerAsyncId } = require('node:async_hooks'); // Async tracking tooling will identify this as 'Q'. const ee1 = new EventEmitterAsyncResource({ name: 'Q' });