Skip to content

Commit f826440

Browse files
committed
doc: improve AsyncResource scope wording
Signed-off-by: Rawal27 <obviouslykamal@gmail.com>
1 parent 404b0cf commit f826440

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

doc/api/async_context.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
These classes are used to associate state and propagate it throughout
1212
callbacks and promise chains.
1313
They allow storing data throughout the lifetime of a web request
14-
or any other asynchronous duration. It is similar to thread-local storage
14+
or any other asynchronous operation. It is similar to thread-local storage
1515
in other languages.
1616

1717
The `AsyncLocalStorage` and `AsyncResource` classes are part of the
@@ -142,7 +142,7 @@ changes:
142142
* `defaultValue` {any} The default value to be used when no store is provided.
143143
* `name` {string} A name for the `AsyncLocalStorage` value.
144144

145-
Creates a new instance of `AsyncLocalStorage`. Store is only provided within a
145+
Creates a new instance of `AsyncLocalStorage`. A Store is only provided within a
146146
`run()` call or after an `enterWith()` call.
147147

148148
### Static method: `AsyncLocalStorage.bind(fn)`
@@ -222,11 +222,11 @@ to `asyncLocalStorage.getStore()` will return `undefined` until
222222
`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
223223

224224
When calling `asyncLocalStorage.disable()`, all current contexts linked to the
225-
instance will be exited.
225+
instance are exited.
226226

227227
Calling `asyncLocalStorage.disable()` is required before the
228228
`asyncLocalStorage` can be garbage collected. This does not apply to stores
229-
provided by the `asyncLocalStorage`, as those objects are garbage collected
229+
provided by the `asyncLocalStorage` instance, as those objects are garbage collected
230230
along with the corresponding async resources.
231231

232232
Use this method when the `asyncLocalStorage` is not in use anymore
@@ -750,7 +750,7 @@ changes:
750750
* `fn` {Function} The function to bind to the current `AsyncResource`.
751751
* `thisArg` {any}
752752

753-
Binds the given function to execute to this `AsyncResource`'s scope.
753+
Binds the given function to execute within this `AsyncResource`'s scope.
754754

755755
### `asyncResource.runInAsyncScope(fn[, thisArg, ...args])`
756756

@@ -773,8 +773,8 @@ then restore the original execution context.
773773
* Returns: {AsyncResource} A reference to `asyncResource`.
774774

775775
Call all `destroy` hooks. This should only ever be called once. An error will
776-
be thrown if it is called more than once. This **must** be manually called. If
777-
the resource is left to be collected by the GC then the `destroy` hooks will
776+
be thrown if it is called more than once. This method **must** be called manually. If
777+
the resource is left to be collected by the GC, then the `destroy` hooks will
778778
never be called.
779779

780780
### `asyncResource.asyncId()`
@@ -811,7 +811,7 @@ parentPort.on('message', (task) => {
811811
});
812812
```
813813

814-
a Worker pool around it could use the following structure:
814+
a worker pool around it could use the following structure:
815815

816816
```mjs
817817
import { AsyncResource } from 'node:async_hooks';

0 commit comments

Comments
 (0)