| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9aa5090 commit 5a56327
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -147,10 +147,10 @@ unintentional side effects. | |||
| 147 | 147 | Because printing to the console is an asynchronous operation, `console.log()` | |
| 148 | 148 | will cause the AsyncHooks callbacks to be called. Using `console.log()` or | |
| 149 | 149 | similar asynchronous operations inside an AsyncHooks callback function will thus | |
| 150 | - cause an infinite recursion. An easily solution to this when debugging is | ||
| 151 | - to use a synchronous logging operation such as `fs.writeSync(1, msg)`. This | ||
| 152 | - will print to stdout because `1` is the file descriptor for stdout and will | ||
| 153 | - not invoke AsyncHooks recursively because it is synchronous. | ||
| 150 | + cause an infinite recursion. An easy solution to this when debugging is to use a | ||
| 151 | + synchronous logging operation such as `fs.writeSync(1, msg)`. This will print to | ||
| 152 | + stdout because `1` is the file descriptor for stdout and will not invoke | ||
| 153 | + AsyncHooks recursively because it is synchronous. | ||
| 154 | 154 | ||
| 155 | 155 | ```js | |
| 156 | 156 | const fs = require('fs'); | |
@@ -587,8 +587,8 @@ JavaScript API so that all the appropriate callbacks are called. | |||
| 587 | 587 | ||
| 588 | 588 | ### `class AsyncResource()` | |
| 589 | 589 | ||
| 590 | - The class `AsyncResource` was designed to be extended by the embedder's async | ||
| 591 | - resources. Using this users can easily trigger the lifetime events of their | ||
| 590 | + The class `AsyncResource` is designed to be extended by the embedder's async | ||
| 591 | + resources. Using this, users can easily trigger the lifetime events of their | ||
| 592 | 592 | own resources. | |
| 593 | 593 | ||
| 594 | 594 | The `init` hook will trigger when an `AsyncResource` is instantiated. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments