diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 726f30c1cd83df..3c4d4fa4d09385 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -1114,8 +1114,9 @@ added: * `...args` {any} Runs a function synchronously within a context and returns its -return value. The store is not accessible outside of the callback function or -the asynchronous operations created within the callback. +return value. The store is not accessible outside of the callback function. +The store is accessible to any asynchronous operations created within the +callback. The optional `args` are passed to the callback function. @@ -1129,6 +1130,9 @@ const store = { id: 2 }; try { asyncLocalStorage.run(store, () => { asyncLocalStorage.getStore(); // Returns the store object + setTimeout(() => { + asyncLocalStorage.getStore(); // Returns the store object + }, 200); throw new Error(); }); } catch (e) {