Thursday, 3 September 2020

Are multiple modules treated as separate macro-tasks?

Imagine I have two modules that look like this:

<script type=“module” src="../js/module1.js"></script>
<script type=“module” src="../js/module2.js"></script>

None of them import from each other.

If module1 is executed before module2, does that means when module1 is popped off the call-stack (and after the micro-queue is emptied and possibly some rendering gets done) the call-stack will be empty - potentially allowing module2 to get pushed on it? Basically, are module1 & module2 treated as two separate macro-tasks or are they treated as one big script?



from Are multiple modules treated as separate macro-tasks?

No comments:

Post a Comment