| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2c621d6 commit 282bf29
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -375,6 +375,7 @@ The following is a simple demonstration of `triggerAsyncId`: | |||
| 375 | 375 | import { createHook, executionAsyncId } from 'node:async_hooks'; | |
| 376 | 376 | import { stdout } from 'node:process'; | |
| 377 | 377 | import net from 'node:net'; | |
| 378 | + import fs from 'node:fs'; | ||
| 378 | 379 | ||
| 379 | 380 | createHook({ | |
| 380 | 381 | init(asyncId, type, triggerAsyncId) { | |
@@ -392,6 +393,7 @@ net.createServer((conn) => {}).listen(8080); | |||
| 392 | 393 | const { createHook, executionAsyncId } = require('node:async_hooks'); | |
| 393 | 394 | const { stdout } = require('node:process'); | |
| 394 | 395 | const net = require('node:net'); | |
| 396 | + const fs = require('node:fs'); | ||
| 395 | 397 | ||
| 396 | 398 | createHook({ | |
| 397 | 399 | init(asyncId, type, triggerAsyncId) { | |
@@ -722,6 +724,7 @@ changes: | |||
| 722 | 724 | ||
| 723 | 725 | ```mjs | |
| 724 | 726 | import { executionAsyncId } from 'node:async_hooks'; | |
| 727 | + import fs from 'node:fs'; | ||
| 725 | 728 | ||
| 726 | 729 | console.log(executionAsyncId()); // 1 - bootstrap | |
| 727 | 730 | fs.open(path, 'r', (err, fd) => { | |
@@ -731,6 +734,7 @@ fs.open(path, 'r', (err, fd) => { | |||
| 731 | 734 | ||
| 732 | 735 | ```cjs | |
| 733 | 736 | const async_hooks = require('node:async_hooks'); | |
| 737 | + const fs = require('node:fs'); | ||
| 734 | 738 | ||
| 735 | 739 | console.log(async_hooks.executionAsyncId()); // 1 - bootstrap | |
| 736 | 740 | fs.open(path, 'r', (err, fd) => { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments