> For the complete documentation index, see [llms.txt](https://jen-hsuan-hsieh.gitbook.io/javascript-node-js/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jen-hsuan-hsieh.gitbook.io/javascript-node-js/chapter1/12javascript-quan-gong-lve-ff1a-ke-fu-js-de-qi-guai-bu-fen/121zhi-xing-huan-jing-yu-ci-hui-huan-jing/12110guan-yu-fei-tong-bu-hui-hu.md).

# 1.2.1.10.關於非同步回呼

* 非同步 (Asynchronous)
  * 在一個時間點不只一段程式碼執行
* The browser
  * JavaScript engine裡面的等待列稱為Event queue

    * 存放可能要發生的事件, 事件通知
    * 當有一個需要被通知的物件在JavaScript engine的某處, 會被放到queue, 我們就可以監聽這個事件 然後用函式回應
    * 舉例來說, 如果有一個按鈕按下去後, **當執行堆是空的時候, JavaScript才會注意到event queue**, 如果有函數對應到這個事件, 他會看這個函數是否可被此事件觸發, **如果可以則會建立新的Execution context給此函數**
      * 1.長時間執行的函式會干擾事件
      * 2.依照事件發生的順序處理
      * 3.**這是發生在JavaScript engine之外的非同步**

    ![](/files/-M4M0Mx6ZeBDaxrpeFYK) ![](/files/-M4M0Mx88ThF0junOoUs)
  * Rendering engine
  * HTTP request&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jen-hsuan-hsieh.gitbook.io/javascript-node-js/chapter1/12javascript-quan-gong-lve-ff1a-ke-fu-js-de-qi-guai-bu-fen/121zhi-xing-huan-jing-yu-ci-hui-huan-jing/12110guan-yu-fei-tong-bu-hui-hu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
