I know that the JS function (ie setTimeout (function () {...}, TIME)) places the function that it received as a parameter in the browser event loop, and that this event loop will be processed after all incoming / synchronous JS calls.
But what actually happens when it has the following HTML page structure:
<html> <head> <script> MANY INLINED SCRIPTS </script> <script src="file.js"></script> <script> setTimeout(function(){...}, TIME)</script> . . .
and the page goes, probably this structure repeats until the value </html> is reached.
When will the event queue be processed in this situation?
edit: I want to create some kind of Lazy Loader for scripts on my page. I rely on content coming from other sources, which should appear only after analyzing the DOM and, hopefully, responsive.
javascript html javascript-events unobtrusive-javascript
Draconar
source share