You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: correct event loop algorithm order and improve technical accuracy
- Fix pseudocode to match HTML spec: task -> microtasks -> render (was render before task)
- Add clarification that 4ms rule output varies by browser/system
- Replace misleading 'separate threads' claims with accurate description
- Fix 'continuously monitors' to 'coordinates execution when stack empty'
- Add setTimeout third parameter as alternative closure fix
- Clarify requestIdleCallback timing (runs if idle time remains)
- Update Loupe tool links from HTTP to HTTPS
Copy file name to clipboardExpand all lines: docs/concepts/event-loop.mdx
+30-21Lines changed: 30 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ Even with a 0ms delay, `Timeout` prints last. The answer lies in the **[event lo
39
39
40
40
## What is the Event Loop?
41
41
42
-
The **event loop** is JavaScript's mechanism for executing code, handling events, and managing asynchronous operations. It continuously monitors the call stack and callback queues, pushing queued tasks to the stack when it's empty. This enables non-blocking behavior despite JavaScript being single-threaded.
42
+
The **event loop** is JavaScript's mechanism for executing code, handling events, and managing asynchronous operations. It coordinates execution by checking callback queues when the call stack is empty, then pushing queued tasks to the stack for execution. This enables non-blocking behavior despite JavaScript being single-threaded.
43
43
44
44
### The Restaurant Analogy
45
45
@@ -177,7 +177,7 @@ To understand the Event Loop, you need to see the full picture:
177
177
│ │ setTimeout() setInterval() fetch() DOM events │ │
Created by Philip Roberts (author of the famous "What the heck is the event loop anyway?" talk). This tool lets you write JavaScript code and watch how it moves through the call stack, Web APIs, and callback queue in real-time.
Interactive tool by Philip Roberts to visualize how the call stack, Web APIs, and callback queue work together. Write code and watch it execute step by step.
0 commit comments