Quantcast

Re: Promises, async functions, and requestAnimationFrame, together.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Promises, async functions, and requestAnimationFrame, together.

/#!/JoePea
Ah, I think the reason that this animation loop using promises works is because promise handlers resolve in the next microtask after the current macrotask. I believe that the animation frame fires in what is essentially a macrotask, then immediately after this macrotask the resolution of the `animationFrame()` promise happens in the following microtask. At some point later, the browser renders stuff, which I think might the next macrotask after the animation frame macrotask.

/#!/JoePea

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Loading...