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