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

Reply via email to