@@ -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 @@ It is possible to have type name collisions. Embedders are encouraged to use
250250unique prefixes, such as the npm package name, to prevent collisions when
251251listening 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 @@ will run *after* the `'uncaughtException'` event is emitted or a `domain`'s
425425handler runs.
426426
427427
428- ##### ` destroy(asyncId) `
428+ ##### destroy(asyncId)
429429
430430* ` asyncId ` {number}
431431
@@ -437,7 +437,7 @@ made to the `resource` object passed to `init` it is possible that `destroy`
437437will never be called, causing a memory leak in the application. If the resource
438438does not depend on garbage collection, then this will not be an issue.
439439
440- ##### ` promiseResolve(asyncId) `
440+ ##### promiseResolve(asyncId)
441441
442442* ` asyncId ` {number}
443443
@@ -464,7 +464,7 @@ init for PROMISE with id 6, trigger id: 5 # the Promise returned by then()
464464 after 6
465465```
466466
467- #### ` async_hooks.executionAsyncId() `
467+ #### async_hooks.executionAsyncId()
468468
469469<!-- YAML
470470added: v8.1.0
@@ -506,7 +506,7 @@ const server = net.createServer(function onConnection(conn) {
506506Note that promise contexts may not get precise executionAsyncIds by default.
507507See the section on [ promise execution tracking] [ ] .
508508
509- #### ` async_hooks.triggerAsyncId() `
509+ #### async_hooks.triggerAsyncId()
510510
511511* Returns: {number} The ID of the resource responsible for calling the callback
512512 that is currently being executed.
@@ -583,7 +583,7 @@ Library developers that handle their own asynchronous resources performing tasks
583583like I/O, connection pooling, or managing callback queues may use the
584584` AsyncWrap ` JavaScript API so that all the appropriate callbacks are called.
585585
586- ### ` class AsyncResource() `
586+ ### Class: AsyncResource
587587
588588The class ` AsyncResource ` is designed to be extended by the embedder's async
589589resources. Using this, users can easily trigger the lifetime events of their
@@ -629,7 +629,7 @@ asyncResource.emitBefore();
629629asyncResource .emitAfter ();
630630```
631631
632- #### ` AsyncResource(type[, options]) `
632+ #### new AsyncResource(type[ , options] )
633633
634634* ` type ` {string} The type of async event.
635635* ` options ` {Object}
@@ -662,7 +662,7 @@ class DBQuery extends AsyncResource {
662662}
663663```
664664
665- #### ` asyncResource.runInAsyncScope(fn[, thisArg, ...args]) `
665+ #### asyncResource.runInAsyncScope(fn[ , thisArg, ...args] )
666666<!-- YAML
667667added: v9.6.0
668668-->
@@ -677,7 +677,7 @@ of the async resource. This will establish the context, trigger the AsyncHooks
677677before callbacks, call the function, trigger the AsyncHooks after callbacks, and
678678then restore the original execution context.
679679
680- #### ` asyncResource.emitBefore() `
680+ #### asyncResource.emitBefore()
681681<!-- YAML
682682deprecated: v9.6.0
683683-->
@@ -693,7 +693,7 @@ will abort. For this reason, the `emitBefore` and `emitAfter` APIs are
693693considered deprecated. Please use ` runInAsyncScope ` , as it provides a much safer
694694alternative.
695695
696- #### ` asyncResource.emitAfter() `
696+ #### asyncResource.emitAfter()
697697<!-- YAML
698698deprecated: v9.6.0
699699-->
@@ -712,18 +712,18 @@ will abort. For this reason, the `emitBefore` and `emitAfter` APIs are
712712considered deprecated. Please use ` runInAsyncScope ` , as it provides a much safer
713713alternative.
714714
715- #### ` asyncResource.emitDestroy() `
715+ #### asyncResource.emitDestroy()
716716
717717Call all ` destroy ` hooks. This should only ever be called once. An error will
718718be thrown if it is called more than once. This ** must** be manually called. If
719719the resource is left to be collected by the GC then the ` destroy ` hooks will
720720never be called.
721721
722- #### ` asyncResource.asyncId() `
722+ #### asyncResource.asyncId()
723723
724724* Returns: {number} The unique ` asyncId ` assigned to the resource.
725725
726- #### ` asyncResource.triggerAsyncId() `
726+ #### asyncResource.triggerAsyncId()
727727
728728* Returns: {number} The same ` triggerAsyncId ` that is passed to the
729729` AsyncResource ` constructor.
0 commit comments