当前位置:网站首页>^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、请求响应模型模型:浏览器、服务器之间传递数据)
边栏推荐
- 连接mysql报错 errorCode 1129, state HY000, Host ‘xxx‘ is blocked because of many connection errors
- Construction of RT thread smart win10 64 bit compilation environment
- KCon 2022 议题大众评选火热进行中!不要错过“心仪”的议题哦~
- 中衍期货靠谱吗?是不是正规期货公司?开户安全吗?
- Is Zhongyan futures a regular platform in China? Is it safe to open an account? Want to open a futures account
- canvas 高级功能(上)
- [generation confrontation network learning part I] classic Gan and its existing problems and related improvements
- pdf.js-----js解析pdf文件实现预览,并获取pdf文件中的内容(数组形式)
- Redis缓存击穿
- Power consumption development experience sharing: design power consumption board
猜你喜欢

AttributeError: module ‘collections‘ has no attribute ‘MutableMapping‘

Pytorch deep learning -- neural network convolution layer conv2d

Redis缓存雪崩

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

Service management and communication, basic principle analysis

72. 编辑距离 ●●●

LeetCode:497. Random points in non overlapping rectangles -- medium

Construction of RT thread smart win10 64 bit compilation environment

You have to learn math to play art?

Niuke.com: numbers that appear more than half of the times in the array
随机推荐
暗黑破坏神不朽数据库怎么用 暗黑破坏神手游不朽数据库使用方法
游戏兼容性测试(通用方案)
Microsoft Word 教程,如何在 Word 中更改页面方向、为页面添加边框?
canvas 高级功能(中)
pytorch深度学习——神经网络卷积层Conv2d
Li Kou 10821084 solution_ Question of SQL query type
Steps to build a personal website using servers purchased by Alibaba cloud international
The most common habits from more than 200 English papers written by gradua
【生成对抗网络学习 其一】经典GAN与其存在的问题和相关改进
Monitoring is easy to create a "quasi ecological" pattern and empower Xinchuang to "replace"
Redis缓存穿透
力扣1082,1084题解_sql查询类型的题目
Game compatibility test (general scheme)
Uncover secrets: how can wechat red envelopes in the Spring Festival Gala resist 10billion requests?
揭秘:春晚微信红包,是如何抗住 100 亿次请求的?
Build a BPMN modeling Web Service
冷酸灵,一个国产品牌IPO的30年曲折史
Networkx usage and nx Draw() related parameters
Identity and access management (IAM)
蛮力法/1~n个整数中取k个整数