Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs: addressing nits pointed out by Trevor
  • Loading branch information
thlorenz committed May 10, 2017
commit d103566841c4f04812adb2b0c6a232ba061fc7d1
16 changes: 10 additions & 6 deletions doc/api/async_hooks.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# Async Hooks


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for the extra blank lines in here

> Stability: 2 - Stable
> Stability: 1 - Experimental


The `async-hooks` module provides an API to register callbacks tracking the
lifetime of asynchronous resources created inside a Node.js application.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include something like:

It can be accessed using `require('async-hooks')`

At its simplest form it can track metadata about each resource and log it when
the program exits.

## Terminology

An async resource represents either a "handle" or a "request".
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than the quotes, make these italic. e.g. handle or a request

Expand Down Expand Up @@ -249,19 +246,26 @@ Output from only starting the server:

```
TCPWRAP(2): trigger: 1 scope: 1
# .listen()
TickObject(3): trigger: 1 scope: 1
TickObject(3): trigger: 2 scope: 1
before: 3
Timeout(4): trigger: 3 scope: 3
TIMERWRAP(5): trigger: 3 scope: 3
after: 3
destroy: 3
before: 5
before: 4
TTYWRAP(6): trigger: 4 scope: 4
SIGNALWRAP(7): trigger: 4 scope: 4
TTYWRAP(8): trigger: 4 scope: 4
>>> 4
TickObject(9): trigger: 4 scope: 4
after: 4
destroy: 4
after: 5
before: 9
after: 9
destroy: 9
destroy: 5
```

First notice that `scope` and the value returned by `currentId()` are always
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*Note*: As illustrated in the example, `currentId()` and `scope` each specify the value
of the current execution context; which is delineated by calls to `before()` and `after()`.

Expand Down