AFAIK, that should execute `drawSomething()` once per frame. Given a frame
is each time the animatinFrame() promise resolves.

On Sat, Apr 23, 2016 at 1:38 AM, /#!/JoePea <[email protected]> wrote:

> Is it possible?
>
>  I thought maybe something like this:
>
> ```js
> function animationFrame() {
>     let resolve = null
>     const promise = new Promise(r => resolve = r)
>     window.requestAnimationFrame(resolve)
>     return promise
> }
>
> async function game() {
>     // the game loop
>     while (true) {
>         await animationFrame()
>         drawSomething()
>     }
> }
>
> game()
> ```
>
> But, I'm not sure what to expect: does the code that follows the await
> statement execute in the frame, sometimes in the frame, or never in
> the frame? What might we expect from the various browsers?
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to