summaryrefslogtreecommitdiff
path: root/doc/api/async_hooks.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/api/async_hooks.md')
-rw-r--r--doc/api/async_hooks.md40
1 files changed, 20 insertions, 20 deletions
diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md
index 54b13f2f0a..863d21dd75 100644
--- a/doc/api/async_hooks.md
+++ b/doc/api/async_hooks.md
@@ -79,12 +79,12 @@ function promiseResolve(asyncId) { }
added: REPLACEME
-->
-* `callbacks` {Object} the [Hook Callbacks][] to register
+* `callbacks` {Object} The [Hook Callbacks][] to register
* `init` {Function} The [`init` callback][].
* `before` {Function} The [`before` callback][].
* `after` {Function} The [`after` callback][].
* `destroy` {Function} The [`destroy` callback][].
-* Returns: `{AsyncHook}` instance used for disabling and enabling hooks
+* Returns: `{AsyncHook}` Instance used for disabling and enabling hooks
Registers functions to be called for different lifetime events of each async
operation.
@@ -168,7 +168,7 @@ doing this the otherwise infinite recursion is broken.
#### `asyncHook.enable()`
-* Returns {AsyncHook} A reference to `asyncHook`.
+* Returns: {AsyncHook} A reference to `asyncHook`.
Enable the callbacks for a given `AsyncHook` instance. If no callbacks are
provided enabling is a noop.
@@ -184,7 +184,7 @@ const hook = async_hooks.createHook(callbacks).enable();
#### `asyncHook.disable()`
-* Returns {AsyncHook} A reference to `asyncHook`.
+* Returns: {AsyncHook} A reference to `asyncHook`.
Disable the callbacks for a given `AsyncHook` instance from the global pool of
AsyncHook callbacks to be executed. Once a hook has been disabled it will not
@@ -200,12 +200,12 @@ instance is destructed.
##### `init(asyncId, type, triggerAsyncId, resource)`
-* `asyncId` {number} a unique ID for the async resource
-* `type` {string} the type of the async resource
-* `triggerAsyncId` {number} the unique ID of the async resource in whose
- execution context this async resource was created
-* `resource` {Object} reference to the resource representing the async operation,
- needs to be released during _destroy_
+* `asyncId` {number} A unique ID for the async resource.
+* `type` {string} The type of the async resource.
+* `triggerAsyncId` {number} The unique ID of the async resource in whose
+ execution context this async resource was created.
+* `resource` {Object} Reference to the resource representing the async operation,
+ needs to be released during _destroy_.
Called when a class is constructed that has the _possibility_ to emit an
asynchronous event. This _does not_ mean the instance must call
@@ -468,7 +468,7 @@ init for PROMISE with id 6, trigger id: 5 # the Promise returned by then()
#### `async_hooks.executionAsyncId()`
-* Returns {number} the `asyncId` of the current execution context. Useful to
+* Returns: {number} The `asyncId` of the current execution context. Useful to
track when something calls.
For example:
@@ -502,7 +502,7 @@ const server = net.createServer(function onConnection(conn) {
#### `async_hooks.triggerAsyncId()`
-* Returns {number} the ID of the resource responsible for calling the callback
+* Returns: {number} The ID of the resource responsible for calling the callback
that is currently being executed.
For example:
@@ -569,9 +569,9 @@ asyncResource.triggerAsyncId();
#### `AsyncResource(type[, triggerAsyncId])`
* arguments
- * `type` {string} the type of async event
- * `triggerAsyncId` {number} the ID of the execution context that created this
- async event
+ * `type` {string} The type of async event.
+ * `triggerAsyncId` {number} The ID of the execution context that created this
+ async event.
Example usage:
@@ -599,7 +599,7 @@ class DBQuery extends AsyncResource {
#### `asyncResource.emitBefore()`
-* Returns {undefined}
+* Returns: {undefined}
Call all `before` callbacks to notify that a new asynchronous execution context
is being entered. If nested calls to `emitBefore()` are made, the stack of
@@ -607,7 +607,7 @@ is being entered. If nested calls to `emitBefore()` are made, the stack of
#### `asyncResource.emitAfter()`
-* Returns {undefined}
+* Returns: {undefined}
Call all `after` callbacks. If nested calls to `emitBefore()` were made, then
make sure the stack is unwound properly. Otherwise an error will be thrown.
@@ -618,7 +618,7 @@ called for all `asyncId`s on the stack if the error is handled by a domain or
#### `asyncResource.emitDestroy()`
-* Returns {undefined}
+* Returns: {undefined}
Call all `destroy` hooks. This should only ever be called once. An error will
be thrown if it is called more than once. This **must** be manually called. If
@@ -627,11 +627,11 @@ never be called.
#### `asyncResource.asyncId()`
-* Returns {number} the unique `asyncId` assigned to the resource.
+* Returns: {number} The unique `asyncId` assigned to the resource.
#### `asyncResource.triggerAsyncId()`
-* Returns {number} the same `triggerAsyncId` that is passed to the `AsyncResource`
+* Returns: {number} The same `triggerAsyncId` that is passed to the `AsyncResource`
constructor.
[`after` callback]: #async_hooks_after_asyncid