Currently I am using an async IIFE like this:
(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 (will it run on all browsers, does it block something important), or should I use something like setTimeout?