Skip to content

Commit 8c8ec4a

Browse files
committed
fix: use doc link instead of example code
1 parent 3517c2a commit 8c8ec4a

1 file changed

Lines changed: 1 addition & 30 deletions

File tree

apps/site/pages/en/learn/asynchronous-work/understanding-processnexttick.md

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,4 @@ Calling `setTimeout(() => {}, 0)` will execute the function at the end of next t
2525

2626
Use `nextTick()` when you want to make sure that in the next event loop iteration that code is already executed.
2727

28-
#### An Example of the [order of events](https://nodejs.org/en/learn/asynchronous-work/event-loop-timers-and-nexttick):
29-
30-
```js
31-
console.log('Hello => number 1');
32-
33-
setImmediate(() => {
34-
console.log('Running at order 3 or 4, setImmediate');
35-
});
36-
37-
setTimeout(() => {
38-
console.log('Running at order 3 or 4, setTimeout');
39-
}, 0);
40-
41-
process.nextTick(() => {
42-
console.log('Running at next tick => number 2');
43-
});
44-
```
45-
46-
#### Example output(possible):
47-
48-
```bash
49-
Hello => number 1
50-
Running at next tick => number 2
51-
Running at order 3 or 4, setImmediate
52-
Running at order 3 or 4, setTimeout
53-
```
54-
55-
In that case, `console.log('Hello => number 1');` will first run because event loop only starts after call stack is cleared.The `nextTick` queue is processed before entering the next phase, which is why the `process.nextTick()` callback runs immediately after.
56-
57-
The execution order of `setImmediate()` and `setTimeout()` can very based on the execution contexts. For more information, refer to [`setImmediate()` vs `setTimeout()`](https://nodejs.org/en/learn/asynchronous-work/event-loop-timers-and-nexttick#setimmediate-vs-settimeout).
28+
For more details on the order of events, refer to [Event loop](https://nodejs.org/en/learn/asynchronous-work/event-loop-timers-and-nexttick).

0 commit comments

Comments
 (0)