I'm programming a game loop and I'm trying to find a way to make it work normally on browser tab switch, getting the actual delta every frame.
This is the behavior when the browser tab is unselected:
JS setInterval(loop, 0) behavior is calling the interval every second instead every frame. That returns a delta of ~1000ms.
Then I try to do it with emscripten and I noticed emscripten_request_animation_frame_loop stops working when I unselect the browser tab. So the delta of my main loop returns to the amount of time the tab was unselected. The main loop is never called while the tab is unselected.
Is there a way to prevent this and let wasm call the loop function every frame even if the browser tab is unselected?