@@ -75,7 +75,7 @@ function destroy(asyncId) { }
7575function promiseResolve (asyncId ) { }
7676```
7777
78- #### ` async_hooks.createHook(callbacks) `
78+ #### async_hooks.createHook(callbacks)
7979
8080<!-- YAML
8181added: v8.1.0
@@ -168,7 +168,7 @@ provided by AsyncHooks itself. The logging should then be skipped when
168168it was the logging itself that caused AsyncHooks callback to call. By
169169doing this the otherwise infinite recursion is broken.
170170
171- #### ` asyncHook.enable() `
171+ #### asyncHook.enable()
172172
173173* Returns: {AsyncHook} A reference to ` asyncHook ` .
174174
@@ -184,7 +184,7 @@ const async_hooks = require('async_hooks');
184184const hook = async_hooks .createHook (callbacks).enable ();
185185```
186186
187- #### ` asyncHook.disable() `
187+ #### asyncHook.disable()
188188
189189* Returns: {AsyncHook} A reference to ` asyncHook ` .
190190
@@ -200,7 +200,7 @@ Key events in the lifetime of asynchronous events have been categorized into
200200four areas: instantiation, before/after the callback is called, and when the
201201instance is destroyed.
202202
203- ##### ` init(asyncId, type, triggerAsyncId, resource) `
203+ ##### init(asyncId, type, triggerAsyncId, resource)
204204
205205* ` asyncId ` {number} A unique ID for the async resource.
206206* ` type ` {string} The type of the async resource.
@@ -250,7 +250,7 @@ Users are able to define their own `type` when using the public embedder API.
250250to use unique prefixes, such as the npm package name, to prevent collisions
251251when listening to the hooks.
252252
253- ###### ` triggerId `
253+ ###### ` triggerAsyncId `
254254
255255` triggerAsyncId ` is the ` asyncId ` of the resource that caused (or "triggered")
256256the new resource to initialize and that caused ` init ` to call. This is different
@@ -396,7 +396,7 @@ The graph only shows *when* a resource was created, not *why*, so to track
396396the * why* use ` triggerAsyncId ` .
397397
398398
399- ##### ` before(asyncId) `
399+ ##### before(asyncId)
400400
401401* ` asyncId ` {number}
402402
@@ -414,7 +414,7 @@ callback multiple times, while other operations like `fs.open()` will call
414414it only once.
415415
416416
417- ##### ` after(asyncId) `
417+ ##### after(asyncId)
418418
419419* ` asyncId ` {number}
420420
@@ -425,7 +425,7 @@ Called immediately after the callback specified in `before` is completed.
425425` domain ` 's handler runs.
426426
427427
428- ##### ` destroy(asyncId) `
428+ ##### destroy(asyncId)
429429
430430* ` asyncId ` {number}
431431
@@ -438,7 +438,7 @@ reference is made to the `resource` object passed to `init` it is possible that
438438the resource does not depend on garbage collection, then this will not be an
439439issue.
440440
441- ##### ` promiseResolve(asyncId) `
441+ ##### promiseResolve(asyncId)
442442
443443* ` asyncId ` {number}
444444
@@ -466,7 +466,7 @@ init for PROMISE with id 6, trigger id: 5 # the Promise returned by then()
466466 after 6
467467```
468468
469- #### ` async_hooks.executionAsyncId() `
469+ #### async_hooks.executionAsyncId()
470470
471471<!-- YAML
472472added: v8.1.0
@@ -508,7 +508,7 @@ const server = net.createServer(function onConnection(conn) {
508508Note that promise contexts may not get precise executionAsyncIds by default.
509509See the section on [ promise execution tracking] [ ] .
510510
511- #### ` async_hooks.triggerAsyncId() `
511+ #### async_hooks.triggerAsyncId()
512512
513513* Returns: {number} The ID of the resource responsible for calling the callback
514514 that is currently being executed.
@@ -585,7 +585,7 @@ Library developers that handle their own asynchronous resources performing tasks
585585like I/O, connection pooling, or managing callback queues may use the
586586` AsyncWrap ` JavaScript API so that all the appropriate callbacks are called.
587587
588- ### ` class AsyncResource() `
588+ ### Class: AsyncResource
589589
590590The class ` AsyncResource ` is designed to be extended by the embedder's async
591591resources. Using this, users can easily trigger the lifetime events of their
@@ -631,7 +631,7 @@ asyncResource.emitBefore();
631631asyncResource .emitAfter ();
632632```
633633
634- #### ` AsyncResource(type[, options]) `
634+ #### new AsyncResource(type[ , options] )
635635
636636* ` type ` {string} The type of async event.
637637* ` options ` {Object}
@@ -664,7 +664,7 @@ class DBQuery extends AsyncResource {
664664}
665665```
666666
667- #### ` asyncResource.runInAsyncScope(fn[, thisArg, ...args]) `
667+ #### asyncResource.runInAsyncScope(fn[ , thisArg, ...args] )
668668<!-- YAML
669669added: v9.6.0
670670-->
@@ -679,7 +679,7 @@ of the async resource. This will establish the context, trigger the AsyncHooks
679679before callbacks, call the function, trigger the AsyncHooks after callbacks, and
680680then restore the original execution context.
681681
682- #### ` asyncResource.emitBefore() `
682+ #### asyncResource.emitBefore()
683683<!-- YAML
684684deprecated: v9.6.0
685685-->
@@ -695,7 +695,7 @@ will abort. For this reason, the `emitBefore` and `emitAfter` APIs are
695695considered deprecated. Please use ` runInAsyncScope ` , as it provides a much safer
696696alternative.
697697
698- #### ` asyncResource.emitAfter() `
698+ #### asyncResource.emitAfter()
699699<!-- YAML
700700deprecated: v9.6.0
701701-->
@@ -714,18 +714,18 @@ will abort. For this reason, the `emitBefore` and `emitAfter` APIs are
714714considered deprecated. Please use ` runInAsyncScope ` , as it provides a much safer
715715alternative.
716716
717- #### ` asyncResource.emitDestroy() `
717+ #### asyncResource.emitDestroy()
718718
719719Call all ` destroy ` hooks. This should only ever be called once. An error will
720720be thrown if it is called more than once. This ** must** be manually called. If
721721the resource is left to be collected by the GC then the ` destroy ` hooks will
722722never be called.
723723
724- #### ` asyncResource.asyncId() `
724+ #### asyncResource.asyncId()
725725
726726* Returns: {number} The unique ` asyncId ` assigned to the resource.
727727
728- #### ` asyncResource.triggerAsyncId() `
728+ #### asyncResource.triggerAsyncId()
729729
730730* Returns: {number} The same ` triggerAsyncId ` that is passed to the
731731` AsyncResource ` constructor.
0 commit comments