That's why this function is not provided in Js?
Currently, all browsers parse Js in the UI thread. Taking Firefox as an example, I re-compiled the JS engine and added the sleep method to the JS alert. This method is called.C LanguageThread sleep function.
Attaches the method to the object, and the method signature is sleep (); No parameter. The default sleep is 1 second. If you call this function in JS, the browser UI interface will be blocked.
In addition, if your JS function has an endless loop, the browser's Js parsing will detect JS execution timeout and remind you whether to terminate the execution of JS on this page.
Finally, a newly compiled JS engine is provided. replace them with the JS engine in Firefox.
Then you can write a piece of Js for fun, such as "testsleep". Sleep (); because I added it to an object, you can call this function on any JS object.
Instructions for use:
It is mainly because Website Visitors need to install your customized browser.
You just need to release the Firefox client.
You must specify your own browser, just as you must install the flash plug-in.
Attachment: firefox_js.rar