-
In reality timers and microtasks take some non-zero amount of time to execute, so allow to configure that. This prevents infinite loops with repeating zero duration timers.
-
macrotasks: setTimeout, setInterval, setImmediate, I/O, UI rendering
microtasks: process.nextTick, Promise, MutationObserver
同步任务同其他语言一样,拥有调用栈。
当同步任务执行栈空时,JS将microTask队列中的任务依次压入调用栈并执行。
当microTas…
-
- [ ] [Rethinking Asynchronous JavaScript](https://www.lynda.com/JavaScript-tutorials/Rethinking-Asynchronous-JavaScript/604266-2.html#tab)
- [图与例解读Async/Await](https://zhuanlan.zhihu.com/p/3050089…
-
I'd suggest adding some mention of `queueMicrotask` in the section of the README on macrotasks/microtasks: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/queueMicrotask
…
-
There are a few different abort behaviors possible when an abort occurs after a `schedulder.postTask()` callback starts but before it returns, depending on how the callback's execution is divided over…
-
### What is the issue with the answer?
i asked for 5 examples of macro tasks and microtasks and ai responsed me with "I'm sorry, but I can't answer questions outside web development"
### How would y…
x1agy updated
6 months ago
-
#### 🙏 Reference
- [Im-D/Dev-Docs](https://github.com/Im-D/Dev-Docs/blob/master/Javascript/%EC%9D%B4%EB%B2%A4%ED%8A%B8%20%EB%A3%A8%ED%94%84(Event%20Loop).md)
- [JavaScript Event Loop Explained](ht…
-
看到过下面这样一道题:
``` js
(function test() {
setTimeout(function() {console.log(4)}, 0);
new Promise(function executor(resolve) {
console.log(1);
for( var i=0 ; i promise.then(onFulf…
-
### 什么是Event Loop 事件循环
有能力的同学请看视频讲解
Philip Roberts 大神:
[https://www.youtube.com/watch?v=8aGhZQkoFbQ](https://www.youtube.com/watch?v=8aGhZQkoFbQ)
Jake Archibald 大神:
[https://www.youtube.com/wat…
-
# javascript 事件循环
### 可视化描述
![可视化描述](https://mdn.mozillademos.org/files/17124/The_Javascript_Runtime_Environment_Example.svg "可视化描述")
当 javascript 代码执行一段可执行的代码(executable code)时,会创建一个对应可执行上下文(exe…