-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
event loop #14
Comments
EventLoop先看下一段代码:
函数调用会产生堆栈 栈堆对象被分配在一个堆中,一个用以表示一个内存中大的未被组织的区域。 调用 setTimeout 函数会在一个时间段过去后在队列中添加一个消息。 零延迟 (Zero delay) 并不是意味着回调会立即执行。在零延迟调用 setTimeout 时
当你点击按钮,会把function onClick 添加到队列中去,调用栈,会在空闲的时候去执行 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
event loop
event loop process model
当一个调用栈为空时,会执行下面的步骤:
6.执行 microtask queue
other
task 在microtask 会在当前循环中执行,macrotask queue 会在下一个event loop 循环中
click, ajax setTimeout 等的callback都是macrotask
参考链接
The text was updated successfully, but these errors were encountered: