Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
doc: in async hooks - correct cjs code to match mjs code
  • Loading branch information
rluvaton committed Jul 24, 2021
commit 45bc79d42202ef29d419444d887f31e6be9a87a9
4 changes: 2 additions & 2 deletions doc/api/async_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -374,14 +374,14 @@ net.createServer((conn) => {}).listen(8080);

```cjs
const { createHook, executionAsyncId } = require('async_hooks');
const { fd } = require('process').stdout;
const { stdout } = require('process');
const net = require('net');

createHook({
init(asyncId, type, triggerAsyncId) {
const eid = executionAsyncId();
fs.writeSync(
fd,
stdout.fd,
`${type}(${asyncId}): trigger: ${triggerAsyncId} execution: ${eid}\n`);
}
}).enable();
Expand Down