8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 118df63 commit 32e5895Copy full SHA for 32e5895
doc/api/async_hooks.md
@@ -78,7 +78,7 @@ function destroy(asyncId) { }
78
function promiseResolve(asyncId) { }
79
```
80
81
-#### async_hooks.createHook(callbacks)
+#### `async_hooks.createHook(callbacks)`
82
83
<!-- YAML
84
added: v8.1.0
@@ -171,7 +171,7 @@ provided by AsyncHooks itself. The logging should then be skipped when
171
it was the logging itself that caused AsyncHooks callback to call. By
172
doing this the otherwise infinite recursion is broken.
173
174
-#### asyncHook.enable()
+#### `asyncHook.enable()`
175
176
* Returns: {AsyncHook} A reference to `asyncHook`.
177
@@ -187,7 +187,7 @@ const async_hooks = require('async_hooks');
187
const hook = async_hooks.createHook(callbacks).enable();
188
189
190
-#### asyncHook.disable()
+#### `asyncHook.disable()`
191
192
193
@@ -203,7 +203,7 @@ Key events in the lifetime of asynchronous events have been categorized into
203
four areas: instantiation, before/after the callback is called, and when the
204
instance is destroyed.
205
206
-##### init(asyncId, type, triggerAsyncId, resource)
+##### `init(asyncId, type, triggerAsyncId, resource)`
207
208
* `asyncId` {number} A unique ID for the async resource.
209
* `type` {string} The type of the async resource.
@@ -390,7 +390,7 @@ API the user's callback is placed in a `process.nextTick()`.
390
The graph only shows *when* a resource was created, not *why*, so to track
391
the *why* use `triggerAsyncId`.
392
393
-##### before(asyncId)
+##### `before(asyncId)`
394
395
* `asyncId` {number}
396
@@ -407,7 +407,7 @@ asynchronous resources like a TCP server will typically call the `before`
407
callback multiple times, while other operations like `fs.open()` will call
408
it only once.
409
410
-##### after(asyncId)
+##### `after(asyncId)`
411
412
413
@@ -417,7 +417,7 @@ If an uncaught exception occurs during execution of the callback, then `after`
417
will run *after* the `'uncaughtException'` event is emitted or a `domain`'s
418
handler runs.
419
420
-##### destroy(asyncId)
+##### `destroy(asyncId)`
421
422
423
@@ -429,7 +429,7 @@ made to the `resource` object passed to `init` it is possible that `destroy`
429
will never be called, causing a memory leak in the application. If the resource
430
does not depend on garbage collection, then this will not be an issue.
431
432
-##### promiseResolve(asyncId)
+##### `promiseResolve(asyncId)`
433
434
435
added: v8.6.0
@@ -460,7 +460,7 @@ init for PROMISE with id 6, trigger id: 5 # the Promise returned by then()
460
after 6
461
462
463
-#### async_hooks.executionAsyncId()
+#### `async_hooks.executionAsyncId()`
464
465
466
@@ -501,7 +501,7 @@ const server = net.createServer((conn) => {
501
Promise contexts may not get precise `executionAsyncIds` by default.
502
See the section on [promise execution tracking][].
503
504
-#### async_hooks.triggerAsyncId()
+#### `async_hooks.triggerAsyncId()`
505
506
* Returns: {number} The ID of the resource responsible for calling the callback
507
that is currently being executed.
@@ -577,7 +577,7 @@ Library developers that handle their own asynchronous resources performing tasks
577
like I/O, connection pooling, or managing callback queues may use the
578
`AsyncWrap` JavaScript API so that all the appropriate callbacks are called.
579
580
-### Class: AsyncResource
+### Class: `AsyncResource`
581
582
The class `AsyncResource` is designed to be extended by the embedder's async
583
resources. Using this, users can easily trigger the lifetime events of their
@@ -615,7 +615,7 @@ asyncResource.asyncId();
615
asyncResource.triggerAsyncId();
616
617
618
-#### new AsyncResource(type\[, options\])
+#### `new AsyncResource(type[, options])`
619
620
* `type` {string} The type of async event.
621
* `options` {Object}
@@ -649,7 +649,7 @@ class DBQuery extends AsyncResource {
649
}
650
651
652
-#### asyncResource.runInAsyncScope(fn\[, thisArg, ...args\])
+#### `asyncResource.runInAsyncScope(fn[, thisArg, ...args])`
653
654
added: v9.6.0
655
-->
@@ -664,7 +664,7 @@ of the async resource. This will establish the context, trigger the AsyncHooks
664
before callbacks, call the function, trigger the AsyncHooks after callbacks, and
665
then restore the original execution context.
666
667
-#### asyncResource.emitDestroy()
+#### `asyncResource.emitDestroy()`
668
669
* Returns: {AsyncResource} A reference to `asyncResource`.
670
@@ -673,11 +673,11 @@ be thrown if it is called more than once. This **must** be manually called. If
673
the resource is left to be collected by the GC then the `destroy` hooks will
674
never be called.
675
676
-#### asyncResource.asyncId()
+#### `asyncResource.asyncId()`
677
678
* Returns: {number} The unique `asyncId` assigned to the resource.
679
680
-#### asyncResource.triggerAsyncId()
+#### `asyncResource.triggerAsyncId()`
681
682
* Returns: {number} The same `triggerAsyncId` that is passed to the
683
`AsyncResource` constructor.