JS Event Loop
The Event Loop has one simple job — to monitor the Call Stack and the Callback Queue. If the Call Stack is empty, it will take the first event from the queue and will push it to the Call Stack, which effectively runs it.
- Function calls form a stack of frames within the Call Stack.
- The Event Loop watches the Callback Queue and adds the frame to the Call Stack to be executed.
- Returning from a function pops is off the Call Stack.
- An Embedded iFrame has it's own call stack, postMessage is the only way to communicate between the two.