diff --git a/doc/api/async_context.md b/doc/api/async_context.md index c7aaac3dbc4..520c5728606 100644 --- a/doc/api/async_context.md +++ b/doc/api/async_context.md @@ -116,13 +116,16 @@ Each instance of `AsyncLocalStorage` maintains an independent storage context. Multiple instances can safely exist simultaneously without risk of interfering with each other's data. -### `new AsyncLocalStorage()` +### `new AsyncLocalStorage([options])` +* `options` {Object} + * `defaultValue` {any} The default value to be used when no store is provided. + * `name` {string} A name for the `AsyncLocalStorage` value. + Creates a new instance of `AsyncLocalStorage`. Store is only provided within a `run()` call or after an `enterWith()` call. @@ -286,6 +293,16 @@ emitter.emit('my-event'); asyncLocalStorage.getStore(); // Returns the same object ``` +### `asyncLocalStorage.name` + + + +* {string} + +The name of the `AsyncLocalStorage` instance if provided. + ### `asyncLocalStorage.run(store, callback[, ...args])`