Skip to content

Commit a1a393b

Browse files
koki-oshimaBethGriggs
koki-oshima
authored andcommitted
doc: use arrow function for anonymous callbacks
PR-URL: #24606 Reviewed-By: Ron Korving <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
1 parent 6788d85 commit a1a393b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

doc/api/async_hooks.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -479,13 +479,12 @@ The ID returned from `executionAsyncId()` is related to execution timing, not
479479
causality (which is covered by `triggerAsyncId()`):
480480

481481
```js
482-
const server = net.createServer(function onConnection(conn) {
482+
const server = net.createServer((conn) => {
483483
// Returns the ID of the server, not of the new connection, because the
484-
// onConnection callback runs in the execution scope of the server's
485-
// MakeCallback().
484+
// callback runs in the execution scope of the server's MakeCallback().
486485
async_hooks.executionAsyncId();
487486

488-
}).listen(port, function onListening() {
487+
}).listen(port, () => {
489488
// Returns the ID of a TickObject (i.e. process.nextTick()) because all
490489
// callbacks passed to .listen() are wrapped in a nextTick().
491490
async_hooks.executionAsyncId();

0 commit comments

Comments
 (0)