Refactoring code to use the "visibilitychange" event

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.
This commit is contained in:
David Négrier 2021-05-11 10:56:50 +02:00
parent 0229f09ec6
commit 23bf78a026
3 changed files with 28 additions and 34 deletions

View file

@ -247,7 +247,6 @@ export class EnableCameraScene extends Phaser.Scene {
update(time: number, delta: number): void {
this.soundMeterSprite.setVolume(this.soundMeter.getVolume());
mediaManager.updateScene();
const middleX = this.getMiddleX();
this.tweens.add({