当前位置:网站首页>^29事件循环模型
^29事件循环模型
2022-06-10 19:59:00 【sanda_nd】
1、所有代码分类:
- 初始化执行代码(同步代码):包含绑定DOM事件监听、设置定时器、发生ajax请求的代码
- 回调执行代码(异步代码):处理回调逻辑
2、JS引擎执行代码的基本流程
初始化代码=>回调代码
3、模型的两个重要组成部分
事件管理模块
回调队列
4、模型的运转流程
- 执行初始化代码,将事件回调函数交给对应模块管理
- 当事件发生时,管理模块会将回调函数及其数据添加到回调队列中
- 只有当初始化代码执行完后(可能要一定时间),才会遍历回调队列中的回调函数执行

5、重要概念
(1、执行栈:所有代码都是在此空间执行的)
(2、浏览器内核:JS引擎模块(主线程)、其他模块(主/分线程))
(3、任务队列)
(4、消息队列)
(5、事件队列)
3、4、5在同一个回调队列
(6、事件轮询:从任务队列中循环取出回调函数放入执行栈中处理)
(7、事件驱动模型:上图)
(8、请求响应模型模型:浏览器、服务器之间传递数据)
边栏推荐
- What is the difference between localhost and 127.0.0.1?
- 力扣1082,1084题解_sql查询类型的题目
- Meetup预告:Linkis新版本介绍以及DSS的应用实践
- Is Zhongyan futures a regular platform in China? Is it safe to open an account? Want to open a futures account
- The old programmer said: stop translating the world, developers should return to programming
- Magic tower game implementation source code and level generation
- vulnhub-The Planets: Earth
- The excess part of the table setting is hidden. Move the mouse to display all
- Niuke.com: numbers that appear more than half of the times in the array
- 【Educational Codeforces Round 120 (Rated for Div. 2)】C. Set or Decrease
猜你喜欢

LeetCode:1037. Effective boomerang - simple

PDF. JS - - - - JS analyse le fichier PDF pour réaliser l'aperçu et obtenir le contenu du fichier PDF (sous forme de tableau)

Construction of RT thread smart win10 64 bit compilation environment

RuntimeError: Attempting to deserialize object on CUDA device 1 but torch.cuda.device_count() is 1.

synergy: server refused client with our name

Error code 1129, state HY000, host 'xxx' is blocked because of many connection errors

Canvas advanced functions (Part 1)

pytorch深度学习——神经网络卷积层Conv2d

2 pcs share a set of keyboard and mouse

User defined date component. The left and right buttons control forward or backward year, month, week and day turning
随机推荐
【Educational Codeforces Round 120 (Rated for Div. 2)】C. Set or Decrease
Leetcode divides the array so that the maximum difference is k
The excess part of the table setting is hidden. Move the mouse to display all
MySQL - common functions
Node (express) implements interfaces such as adding, deleting, modifying, and paging
Zero trust architecture
Power consumption development experience sharing: design power consumption board
Uni app custom navigation
Canvas advanced functions (Part 1)
node(express)实现增删改查、分页等接口
The most common habits from more than 200 English papers written by gradua
连接mysql报错 errorCode 1129, state HY000, Host ‘xxx‘ is blocked because of many connection errors
20192407 2021-2022-2 experimental report on Experiment 8 of network and system attack and Defense Technology
Niuke.com: numbers that appear more than half of the times in the array
暗黑破坏神不朽WIKI地址 暗黑破坏神不朽数据库地址分享
Is Zhongyan futures reliable? Is it a regular futures company? Is it safe to open an account?
連接mysql報錯 errorCode 1129, state HY000, Host ‘xxx‘ is blocked because of many connection errors
AttributeError: module ‘collections‘ has no attribute ‘MutableMapping‘
Cut rope / integer split
72. editing distance ●●