23bf78a026
Using the "visiblitychange" event instead of relying on a "trick" related to RAF being disabled when a window is not open allows us to have cleaner code. Bonus: the recursive call to "setTimeout" is gone, so the stacktrace growing indefinitely is gone too. This should make the application a bit more stable.