Skip to content

Commit b65ffd5

Browse files
koki-oshimarvagg
koki-oshima
authored andcommitted
doc: use arrow function for anonymous callbacks
PR-URL: #24606 Reviewed-By: Ron Korving <ron@ronkorving.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
1 parent d4491a4 commit b65ffd5

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)