diveDylan / blog

My blog, detail is in the issues list
2 stars 0 forks source link

宏任务队列timer的入队(达达到家) #35

Open diveDylan opened 4 years ago

diveDylan commented 4 years ago
setTimeout(() => 
 console.log('task 100ms')
},100)
setTimeout(() => 
 console.log('task 10ms')
},10)

// output 
// 1、task 100ms
// 2、task 10ms

timer算是同步任务,setimeout(fn,delay)中的fn为回调的宏任务,整个事件机制的执行更像是这样

---get timer 100ms
---get timer 10ms
--- mic Task [timer10Fn]
--- mic Task[timer100Fn]