I am struggling to overcome the issue of coming back from a browser tab because I’m using async calls and recursive functions to call a blockchain. The only solution I have found after more than a week is to restart the game fresh and nuke absolutely everything. The only thing is I can’t figure out how to do that either.
Pause is bad because it saves the state when you trigger it on visibility change. Shutdown is bad for the same reasons. It doesn’t clear the pending sounds or tweens. Start works, but not in the expected way. You cannot restart, so if you destroy the game, then you cannot then start it again. The best solution I have now is to destroy things, and have a listener put a banner that the user needs to hard refresh the page.
It’s been a couple weeks, and I haven’t been able to progress with Phaser as I haven’t figured out how to refresh the scene. I am having audio and tweens backup when tabbed away, but I cannot figure out how remove them from the queue, so the only solution left is to restart the game.
It’s very frustrating to have browsers behave irregularly and to not have examples anywhere as well. IF anyone could help here it would be greatly appreciated.
For anyone else visiting this post, looking for an answer; you can simply call “location.reload();” to reload the game (it basically works like the Refresh button).