Development and application of one-to-one live broadcast script

The principle of the one-to-one live broadcast script is that when the host opens the Squirrel Live Manager during the live broadcast, the system will automatically screen high-quality users, and will actively send users messages, photos, voice greetings, and intelligent responses. At the same time, to increase the exposure of the host and reduce the blank period of the host.
Insert picture description here

Delayed scripts
Generally, if you want to delay the script to run after the entire page has been loaded, set

But it can also be like this:

This will achieve the same goal and keep the code clean.

Asynchronous script
Similar to defer, async is only used for external script files and tells the browser to download the file immediately.

But unlike defer, async scripts are not guaranteed to execute in the order in which they are specified.

Using async is also a bit different from defer:

Note: In the xhtml document, it must look like this:

Then look at the following piece of code:

In the above code, example2.js may be executed before example1.js. Therefore, it is important to ensure that the two are not dependent on each other.

The purpose of specifying the async attribute is to prevent the page from waiting for two scripts to download and execute, so that other content can be loaded asynchronously. Therefore, asynchronous scripts cannot modify the DOM during loading.

Guess you like

Origin blog.csdn.net/weixin_46374933/article/details/113178798