Skip to content

Commit e958ee7

Browse files
koki-oshimaTrott
koki-oshima
authored andcommitted
doc: use arrow function for anonymous callbacks
PR-URL: nodejs#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 9298683 commit e958ee7

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
@@ -478,13 +478,12 @@ The ID returned from `executionAsyncId()` is related to execution timing, not
478478
causality (which is covered by `triggerAsyncId()`):
479479

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

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

0 commit comments

Comments
 (0)