Reputation: 2300
This question uses my understanding that:
Question: How does JS code being executed on the call-stack block rendering?
I know every window has one main-thread.
I know both JS code and rendering code are executed on the main-thread.
I know the browser wants to re-paint about every 16 ms.
Lastly, I get the impression the call-stack just executes JS functions and rendering tasks are not executed on the call-stack.
Perhaps to answer this question I'd need to know:
Upvotes: 0
Views: 285
Reputation: 1203
What does a main thread look like?
Functionally, a browser window's main thread will do
All JS execution for a window is single-threaded. There are dependencies between these actions that would cause scripts or actions in the scripts to wait.
So, when the JS execution involves complex processing, it can perceptibly impact the window render.
Upvotes: 1
Reputation: 169051
There is only one thread running Javascript per browser tab/frame/window/WebWorker, and while Javascript is running, rendering will generally not happen.
There is no specific concept called a main stack aside from the call stack of whatever code may be running on the main thread.
Upvotes: 1