Skip to content

Commit 8d336dd

Browse files
committed
doc: improve text in async_hooks.md
* Remove unnecessary *Note:* designations. * Various small edits for tone, punctuation, etc. PR-URL: #19312 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 5e23b65 commit 8d336dd

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

doc/api/async_hooks.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,9 @@ instances and asynchronous work scheduled by them.
246246

247247
Users are able to define their own `type` when using the public embedder API.
248248

249-
*Note:* It is possible to have type name collisions. Embedders are encouraged
250-
to use unique prefixes, such as the npm package name, to prevent collisions
251-
when listening to the hooks.
249+
It is possible to have type name collisions. Embedders are encouraged to use
250+
unique prefixes, such as the npm package name, to prevent collisions when
251+
listening to the hooks.
252252

253253
###### `triggerId`
254254

@@ -282,10 +282,10 @@ TCPWRAP(4): trigger: 2 execution: 0
282282
The `TCPSERVERWRAP` is the server which receives the connections.
283283

284284
The `TCPWRAP` is the new connection from the client. When a new
285-
connection is made the `TCPWrap` instance is immediately constructed. This
286-
happens outside of any JavaScript stack (side note: a `executionAsyncId()` of
287-
`0` means it's being executed from C++, with no JavaScript stack above it).
288-
With only that information, it would be impossible to link resources together in
285+
connection is made, the `TCPWrap` instance is immediately constructed. This
286+
happens outside of any JavaScript stack. (An `executionAsyncId()` of `0` means
287+
that it is being executed from C++ with no JavaScript stack above it). With only
288+
that information, it would be impossible to link resources together in
289289
terms of what caused them to be created, so `triggerAsyncId` is given the task
290290
of propagating what resource is responsible for the new resource's existence.
291291

@@ -420,9 +420,9 @@ it only once.
420420

421421
Called immediately after the callback specified in `before` is completed.
422422

423-
*Note:* If an uncaught exception occurs during execution of the callback, then
424-
`after` will run *after* the `'uncaughtException'` event is emitted or a
425-
`domain`'s handler runs.
423+
If an uncaught exception occurs during execution of the callback, then `after`
424+
will run *after* the `'uncaughtException'` event is emitted or a `domain`'s
425+
handler runs.
426426

427427

428428
##### `destroy(asyncId)`
@@ -432,11 +432,10 @@ Called immediately after the callback specified in `before` is completed.
432432
Called after the resource corresponding to `asyncId` is destroyed. It is also
433433
called asynchronously from the embedder API `emitDestroy()`.
434434

435-
*Note:* Some resources depend on garbage collection for cleanup, so if a
436-
reference is made to the `resource` object passed to `init` it is possible that
437-
`destroy` will never be called, causing a memory leak in the application. If
438-
the resource does not depend on garbage collection, then this will not be an
439-
issue.
435+
Some resources depend on garbage collection for cleanup, so if a reference is
436+
made to the `resource` object passed to `init` it is possible that `destroy`
437+
will never be called, causing a memory leak in the application. If the resource
438+
does not depend on garbage collection, then this will not be an issue.
440439

441440
##### `promiseResolve(asyncId)`
442441

@@ -447,9 +446,8 @@ invoked (either directly or through other means of resolving a promise).
447446

448447
Note that `resolve()` does not do any observable synchronous work.
449448

450-
*Note:* This does not necessarily mean that the `Promise` is fulfilled or
451-
rejected at this point, if the `Promise` was resolved by assuming the state
452-
of another `Promise`.
449+
The `Promise` is not necessarily fulfilled or rejected at this point if the
450+
`Promise` was resolved by assuming the state of another `Promise`.
453451

454452
```js
455453
new Promise((resolve) => resolve(true)).then((a) => {});

0 commit comments

Comments
 (0)