If you use simple script tags on an HTML page, rendering is blocked until the script is loaded and parsed. To avoid this, to display the page faster, you can add the "async" attribute, which tells the browser to continue processing the page without waiting for the script. However, this essentially means that another javascript that references anything in this script is likely to crash because the required objects do not yet exist.
As far as I know, there is no allScriptsLoaded event that you can bind to, so I'm looking for ways to simulate it.
I know the following strategies to delay the launch of another code until an async script is available:
Am I missing something, or is it a state of art?
, , , - (XMLHttpRequest, setTimeout, setInterval, SetImmediate, process.nextTick, Promise) , . , , - javascript , , . , . , ( io.js frisky).
, script script. (.. , script .)
, DOM NoAsyncPending -, .
Source: https://habr.com/ru/post/1605817/More articles:Plotly - publishing my story with R - rFetch API - Cross Domain - javascriptHow to return Parse promise from the cloud code module? - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1605815/convert-json-objects-to-rdd&usg=ALkJrhjuR4X5yK8XZWELj58p6O3L-qPbmAHow to specify only specific fields using read.schema in JSON: SPARK Scala - jsonAre characters automatically expressed in C expressions? - c ++Поверните список имен компаний в тикеры - pythonintellij thymeleaf th namespace unconnected - intellij-ideaC # application accidentally freezes when called from Process.Start () - c #How to combine @Rule and @ClassRule in JUnit 4.12 - javaAll Articles