From 0d73e9061a9b676533ff964d2205b7aee372af27 Mon Sep 17 00:00:00 2001 From: koki-oshima Date: Sat, 24 Nov 2018 16:35:20 +0900 Subject: [PATCH 1/2] docs: fix replace anonymous function with arrow function --- doc/api/async_hooks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index b1abfc63a2ea42..36da56ec2903ea 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -478,13 +478,13 @@ 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(). 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(); From c771a526f436a875981c7edb874f34dcb2dd3dc4 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 24 Nov 2018 20:45:28 -0800 Subject: [PATCH 2/2] fixup --- doc/api/async_hooks.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 36da56ec2903ea..c1acaadcbba7c7 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -480,8 +480,7 @@ causality (which is covered by `triggerAsyncId()`): ```js 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, () => {