Currently I am using an async IIFE like this:
<code>(async () => {
while(true) {
...game loop
}
})()
</code>
<code>(async () => {
while(true) {
...game loop
}
})()
</code>
(async () => {
while(true) {
...game loop
}
})()
The game loop is used to draw animations in a canvas element.
This works fine, (even though microtasks aren’t ran on a new thread), yet I have never seen it mentioned anywhere on the internet, so my question is, is this ok, or should I use something like setTimeout?