diff options
author | Rich Trott <rtrott@gmail.com> | 2021-10-11 07:55:04 +0300 |
---|---|---|
committer | Antoine du Hamel <duhamelantoine1995@gmail.com> | 2021-10-20 12:59:11 +0300 |
commit | d0b58c0287e67a139137aa906819d95f8314b093 (patch) | |
tree | e9a92870138d89b608b1c6e6568611744c32c4f2 /doc/api/async_hooks.md | |
parent | a7c17e08de658cbc0beefd8e9583803b5a62ac7e (diff) |
doc: format doc/api/*.md with markdown formatter
PR-URL: https://github.com/nodejs/node/pull/40403
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Diffstat (limited to 'doc/api/async_hooks.md')
-rw-r--r-- | doc/api/async_hooks.md | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 132f2a6bb2e..c3170f8162f 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -190,7 +190,7 @@ const asyncHook = async_hooks.createHook(new MyAddedCallbacks()); Because promises are asynchronous resources whose lifecycle is tracked via the async hooks mechanism, the `init()`, `before()`, `after()`, and -`destroy()` callbacks *must not* be async functions that return promises. +`destroy()` callbacks _must not_ be async functions that return promises. ### Error handling @@ -350,8 +350,8 @@ listening to the hooks. `triggerAsyncId` is the `asyncId` of the resource that caused (or "triggered") the new resource to initialize and that caused `init` to call. This is different -from `async_hooks.executionAsyncId()` that only shows *when* a resource was -created, while `triggerAsyncId` shows *why* a resource was created. +from `async_hooks.executionAsyncId()` that only shows _when_ a resource was +created, while `triggerAsyncId` shows _why_ a resource was created. The following is a simple demonstration of `triggerAsyncId`: @@ -499,13 +499,13 @@ TickObject(6) The `TCPSERVERWRAP` is not part of this graph, even though it was the reason for `console.log()` being called. This is because binding to a port without a host -name is a *synchronous* operation, but to maintain a completely asynchronous +name is a _synchronous_ operation, but to maintain a completely asynchronous API the user's callback is placed in a `process.nextTick()`. Which is why `TickObject` is present in the output and is a 'parent' for `.listen()` callback. -The graph only shows *when* a resource was created, not *why*, so to track -the *why* use `triggerAsyncId`. Which can be represented with the following +The graph only shows _when_ a resource was created, not _why_, so to track +the _why_ use `triggerAsyncId`. Which can be represented with the following graph: ```console @@ -545,7 +545,7 @@ it only once. Called immediately after the callback specified in `before` is completed. If an uncaught exception occurs during execution of the callback, then `after` -will run *after* the `'uncaughtException'` event is emitted or a `domain`'s +will run _after_ the `'uncaughtException'` event is emitted or a `domain`'s handler runs. #### `destroy(asyncId)` |