Skip to content

Commit

Permalink
doc: revise method text in async_hooks.md
Browse files Browse the repository at this point in the history
Fix two typographical errors ("This methods") and general minor edits
around the use of the word "method" in async_hooks.md.

PR-URL: #36736
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Harshitha K P <[email protected]>
  • Loading branch information
Trott authored and targos committed May 1, 2021
1 parent 682d0a9 commit 8620458
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions doc/api/async_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -1000,14 +1000,14 @@ added: v13.10.0
-->

Creates a new instance of `AsyncLocalStorage`. Store is only provided within a
`run` or after `enterWith` method call.
`run()` call or after an `enterWith()` call.

### `asyncLocalStorage.disable()`
<!-- YAML
added: v13.10.0
-->

This method disables the instance of `AsyncLocalStorage`. All subsequent calls
Disables the instance of `AsyncLocalStorage`. All subsequent calls
to `asyncLocalStorage.getStore()` will return `undefined` until
`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.

Expand All @@ -1019,7 +1019,7 @@ Calling `asyncLocalStorage.disable()` is required before the
provided by the `asyncLocalStorage`, as those objects are garbage collected
along with the corresponding async resources.

This method is to be used when the `asyncLocalStorage` is not in use anymore
Use this method when the `asyncLocalStorage` is not in use anymore
in the current process.

### `asyncLocalStorage.getStore()`
Expand All @@ -1029,10 +1029,10 @@ added: v13.10.0

* Returns: {any}

This method returns the current store.
If this method is called outside of an asynchronous context initialized by
calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it will
return `undefined`.
Returns the current store.
If called outside of an asynchronous context initialized by
calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it
returns `undefined`.

### `asyncLocalStorage.enterWith(store)`
<!-- YAML
Expand All @@ -1041,7 +1041,7 @@ added: v13.11.0

* `store` {any}

This method transitions into the context for the remainder of the current
Transitions into the context for the remainder of the current
synchronous execution and then persists the store through any following
asynchronous calls.

Expand All @@ -1061,7 +1061,7 @@ This transition will continue for the _entire_ synchronous execution.
This means that if, for example, the context is entered within an event
handler subsequent event handlers will also run within that context unless
specifically bound to another context with an `AsyncResource`. That is why
`run` should be preferred over `enterWith` unless there are strong reasons
`run()` should be preferred over `enterWith()` unless there are strong reasons
to use the latter method.

```js
Expand All @@ -1088,7 +1088,7 @@ added: v13.10.0
* `callback` {Function}
* `...args` {any}

This methods runs a function synchronously within a context and return its
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.

Expand Down Expand Up @@ -1120,7 +1120,7 @@ added: v13.10.0
* `callback` {Function}
* `...args` {any}

This methods runs a function synchronously outside of a context and return its
Runs a function synchronously outside of a context and returns its
return value. The store is not accessible within the callback function or
the asynchronous operations created within the callback. Any `getStore()`
call done within the callback function will always return `undefined`.
Expand Down

0 comments on commit 8620458

Please sign in to comment.