JavaScript Async, Callback

Source: Internet
Author: User
1: triggering and execution is not the same concept, the callback function of the timer must be triggered after the time of the specified delay, but not necessarily immediately , may need to wait. All JavaScript code is executed in one thread, and events such as mouse clicks and timers are only executed when the JS single-thread is idle.

2: In the browser, the JavaScript engine is event-driven, where events can be thought of as a variety of tasks that the browser assigns to it, which may originate from the currently executing block of code, such as calling settimeout (), or from the browser kernel, such as the onload (), OnClick (), onmouseover (), SetTimeOut (), SetInterval (), Ajax, and so on. From the point of view of the code, the so-called task entity is a variety of callback functions, because of the "single-threaded" reason, these tasks will be queued, one after another waiting to be processed by the engine.

JavaScript Async, Callback

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.