@@ -92,10 +92,10 @@ operation.
9292The callbacks ` init() ` /` before() ` /` after() ` /` destroy() ` are called for the
9393respective asynchronous event during a resource's lifetime.
9494
95- All callbacks are optional. So, for example, if only resource cleanup needs to
96- be tracked then only the ` destroy ` callback needs to be passed. The
97- specifics of all functions that can be passed to ` callbacks ` is in the section
98- [ Hook Callbacks] [ ] .
95+ All callbacks are optional. For example, if only resource cleanup needs to
96+ be tracked, then only the ` destroy ` callback needs to be passed. The
97+ specifics of all functions that can be passed to ` callbacks ` is in the
98+ [ Hook Callbacks] [ ] section .
9999
100100``` js
101101const async_hooks = require (' async_hooks' );
@@ -125,7 +125,7 @@ const asyncHook = async_hooks.createHook(new MyAddedCallbacks());
125125##### Error Handling
126126
127127If any ` AsyncHook ` callbacks throw, the application will print the stack trace
128- and exit. The exit path does follow that of an uncaught exception but
128+ and exit. The exit path does follow that of an uncaught exception, but
129129all ` uncaughtException ` listeners are removed, thus forcing the process to
130130exit. The ` 'exit' ` callbacks will still be called unless the application is run
131131with ` --abort-on-uncaught-exception ` , in which case a stack trace will be
@@ -173,7 +173,7 @@ doing this the otherwise infinite recursion is broken.
173173Enable the callbacks for a given ` AsyncHook ` instance. If no callbacks are
174174provided enabling is a noop.
175175
176- The ` AsyncHook ` instance is by default disabled . If the ` AsyncHook ` instance
176+ The ` AsyncHook ` instance is disabled by default. If the ` AsyncHook ` instance
177177should be enabled immediately after creation, the following pattern can be used.
178178
179179``` js
@@ -196,7 +196,7 @@ For API consistency `disable()` also returns the `AsyncHook` instance.
196196
197197Key events in the lifetime of asynchronous events have been categorized into
198198four areas: instantiation, before/after the callback is called, and when the
199- instance is destructed .
199+ instance is destroyed .
200200
201201##### ` init(asyncId, type, triggerAsyncId, resource) `
202202
@@ -283,7 +283,7 @@ The second `TCPWRAP` is the new connection from the client. When a new
283283connection is made the ` TCPWrap ` instance is immediately constructed. This
284284happens outside of any JavaScript stack (side note: a ` executionAsyncId() ` of ` 0 `
285285means it's being executed from C++, with no JavaScript stack above it).
286- With only that information it would be impossible to link resources together in
286+ With only that information, it would be impossible to link resources together in
287287terms of what caused them to be created, so ` triggerAsyncId ` is given the task of
288288propagating what resource is responsible for the new resource's existence.
289289
@@ -295,8 +295,8 @@ the value of `type`. For instance, for the `GETADDRINFOREQWRAP` resource type,
295295` resource ` provides the hostname used when looking up the IP address for the
296296hostname in ` net.Server.listen() ` . The API for accessing this information is
297297currently not considered public, but using the Embedder API, users can provide
298- and document their own resource objects. Such a resource object could for
299- example contain the SQL query being executed.
298+ and document their own resource objects. For example, such a resource object
299+ could contain the SQL query being executed.
300300
301301In the case of Promises, the ` resource ` object will have ` promise ` property
302302that refers to the Promise that is being initialized, and a ` parentId ` property
@@ -385,7 +385,7 @@ Only using `execution` to graph resource allocation results in the following:
385385TTYWRAP(6) -> Timeout(4) -> TIMERWRAP(5) -> TickObject(3) -> root(1)
386386```
387387
388- The ` TCPWRAP ` is not part of this graph; even though it was the reason for
388+ The ` TCPWRAP ` is not part of this graph, even though it was the reason for
389389` console.log() ` being called. This is because binding to a port without a
390390hostname is a * synchronous* operation, but to maintain a completely asynchronous
391391API the user's callback is placed in a ` process.nextTick() ` .
@@ -408,7 +408,7 @@ The `before` callback will be called 0 to N times. The `before` callback
408408will typically be called 0 times if the asynchronous operation was cancelled
409409or, for example, if no connections are received by a TCP server. Persistent
410410asynchronous resources like a TCP server will typically call the ` before `
411- callback multiple times, while other operations like ` fs.open() ` will only call
411+ callback multiple times, while other operations like ` fs.open() ` will call
412412it only once.
413413
414414
@@ -418,7 +418,7 @@ it only once.
418418
419419Called immediately after the callback specified in ` before ` is completed.
420420
421- * Note:* If an uncaught exception occurs during execution of the callback then
421+ * Note:* If an uncaught exception occurs during execution of the callback, then
422422` after ` will run * after* the ` 'uncaughtException' ` event is emitted or a
423423` domain ` 's handler runs.
424424
@@ -568,10 +568,9 @@ asyncResource.triggerAsyncId();
568568
569569#### ` AsyncResource(type[, triggerAsyncId]) `
570570
571- * arguments
572- * ` type ` {string} The type of async event.
573- * ` triggerAsyncId ` {number} The ID of the execution context that created this
574- async event.
571+ * ` type ` {string} The type of async event.
572+ * ` triggerAsyncId ` {number} The ID of the execution context that created this
573+ async event.
575574
576575Example usage:
577576
0 commit comments