Home  >  Article  >  Web Front-end  >  10 course recommendations about webWorker

10 course recommendations about webWorker

巴扎黑
巴扎黑Original
2017-06-14 17:00:441316browse

During web development, it is often encountered that the browser does not respond to events and enters a state of suspended animation, or even pops up a "script running time too long" prompt box. If this happens, it means that your script is out of control. A browser has at least three threads: js engine thread (processing js), GUI rendering thread (rendering page), and browser event trigger thread (controlling interaction). 1: The JavaScript engine is based on event-driven single-thread execution. The JS engine has been waiting for the arrival of tasks in the task queue and then processed them. The browser has only one JS thread running the JS program at any time. 2: The GUI rendering thread is responsible for rendering the browser interface. When the interface needs to be repainted (Repaint) or a reflow is caused by a certain operation, this thread will be executed. However, it should be noted that the GUI rendering thread and the JS engine are mutually exclusive. When the JS engine is executed, the GUI thread will be suspended and the GUI update will be interrupted.

Introduction: During web development, it is often encountered that the browser does not respond to events and enters a state of suspended animation, or even pops up a "script running time is too long" prompt box. If this happens, it means that your script is out of control. .

2. 10 course recommendations about webWorkerIntroduction to Promise in JavaScript in detail

Introduction: 1. Introduction JavaScript is single-threaded and can only execute one task at a time. When there is a task, it takes a long time. If it takes a long time, subsequent tasks will have to wait. So, is there any way to solve this kind of problem? (Leave aside WebWorker), that is to let the code execute asynchronously. What does it mean? For example, during an Ajax asynchronous request, the value of readyState is continuously monitored to determine the execution of the specified callback function. There are usually three types of asynchronous execution, callback functions, event listening, and publish and subscribe. Event listening and publish and subscribe are actually similar, but the latter is more robust. Such as callback function, return...

3. 10 course recommendations about webWorkerhtml5 multi-threaded processing webWorker

Introduction: Web Worker provides a simple way to enable web content to run scripts in the background. Once a worker is created, it can pass messages to the event listening function specified by its creator, so that all tasks generated by the worker will receive these messages. js - The angular directive contains webworker. In the unit test, the worker file cannot be found error is always reported. How to solve it?

The above is the detailed content of 10 course recommendations about webWorker. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn