From 2d4a04267570e7c7ffe7f46e4bf82719000d265e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Fri, 22 Oct 2021 13:58:33 +0200 Subject: [PATCH] doc: improve async_context introduction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename "Async_context" to "Asynchronous context tracking" in toc. - Use named imports to show how `AsyncLocalStorage` and `AsyncResource` can be imported. PR-URL: https://github.com/nodejs/node/pull/40560 Reviewed-By: Vladimir de Turckheim Reviewed-By: Tobias Nießen Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: Voltrex Reviewed-By: Zijian Liu Reviewed-By: Gerhard Stöbich --- doc/api/async_context.md | 6 +++--- doc/api/index.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api/async_context.md b/doc/api/async_context.md index c944d25d34ad56..137a84151f0da1 100644 --- a/doc/api/async_context.md +++ b/doc/api/async_context.md @@ -1,4 +1,4 @@ -# Asynchronous Context Tracking +# Asynchronous context tracking @@ -18,11 +18,11 @@ The `AsyncLocalStorage` and `AsyncResource` classes are part of the `async_hooks` module: ```mjs -import async_hooks from 'async_hooks'; +import { AsyncLocalStorage, AsyncResource } from 'async_hooks'; ``` ```cjs -const async_hooks = require('async_hooks'); +const { AsyncLocalStorage, AsyncResource } = require('async_hooks'); ``` ## Class: `AsyncLocalStorage` diff --git a/doc/api/index.md b/doc/api/index.md index 0e7bf073d2843c..7aba47edcb35af 100644 --- a/doc/api/index.md +++ b/doc/api/index.md @@ -11,7 +11,7 @@
* [Assertion testing](assert.md) -* [Async\_context](async\_context.md) +* [Asynchronous context tracking](async\_context.md) * [Async hooks](async\_hooks.md) * [Buffer](buffer.md) * [C++ addons](addons.md)