Skip to content

Commit 3aacf44

Browse files
flakey5jasnell
andauthored
Apply suggestions from code review
Co-authored-by: James M Snell <[email protected]>
1 parent 2846886 commit 3aacf44

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

doc/api/async_context.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ this time will print the stack trace and exit. See
147147
Creating an async resource within the `onPropagate` callback will result in
148148
a recursive call to `onPropagate`.
149149

150-
### `asyncLocalStorage.bind(fn, thisArg)`
150+
### `asyncLocalStorage.bind(fn [, thisArg])`
151151

152152
<!-- YAML
153153
added: REPLACEME
@@ -167,13 +167,14 @@ the `AsyncResource` to which the function is bound.
167167
added: REPLACEME
168168
-->
169169

170-
Returns a callback that captures the current async context and invokes a callback passed into it within the captured async context.
170+
Returns a callback that captures the current async context and invokes a callback passed into it
171+
within the captured async context.
171172

172173
```js
173174
const asyncLocalStorage = new AsyncLocalStorage();
174175
const runInAsyncScope = asyncLocalStorage.run(123, () => als.snapshot());
175176
const result = asyncLocalStorage.run(321, () => runInAsyncScope(() => asyncLocalStorage.getStore()));
176-
console.log(result) // returns 123
177+
console.log(result); // returns 123
177178
```
178179

179180
AsyncLocalStorage.snapshot() can replace the use of AsyncResource for simple async context tracking purposes, for example:

0 commit comments

Comments
 (0)