From b65ffd5b1d5a5017251e4d019b01e86915f20ca2 Mon Sep 17 00:00:00 2001 From: koki-oshima Date: Sat, 24 Nov 2018 16:35:20 +0900 Subject: [PATCH] doc: use arrow function for anonymous callbacks PR-URL: https://github.com/nodejs/node/pull/24606 Reviewed-By: Ron Korving Reviewed-By: Joyee Cheung Reviewed-By: Vse Mozhet Byt Reviewed-By: Gireesh Punathil --- doc/api/async_hooks.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 1529e33e474084..e95c7f4ef6f6da 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -479,13 +479,12 @@ The ID returned from `executionAsyncId()` is related to execution timing, not causality (which is covered by `triggerAsyncId()`): ```js -const server = net.createServer(function onConnection(conn) { +const server = net.createServer((conn) => { // Returns the ID of the server, not of the new connection, because the - // onConnection callback runs in the execution scope of the server's - // MakeCallback(). + // callback runs in the execution scope of the server's MakeCallback(). async_hooks.executionAsyncId(); -}).listen(port, function onListening() { +}).listen(port, () => { // Returns the ID of a TickObject (i.e. process.nextTick()) because all // callbacks passed to .listen() are wrapped in a nextTick(). async_hooks.executionAsyncId();