indigo
indigo copied to clipboard
Report Visibility Changes
When a page is switched out (such as the user switching tabs) it would be useful to know that the visibility state has changed. This will allow us to pause the game, or reduce some of the heavier parts of the game for example. We should listen for the document.visibilitychange
event and then report the new state to Indigo
It's issues like this that make me think Indigo should move to a Tyrian-like message system (https://github.com/PurpleKingdomGames/indigo/issues/614), and in fact move to being built on-top of Tyrian (https://github.com/PurpleKingdomGames/indigo/issues/506).
The request in this issue is perfectly reasonable, but from an Indigo technical strategy perspective, it's not sensible / scale-able to listen to every browser event that someone might want to listen to. We'll just end up with loads of dead weight messages.
As a bonus, we'd gain exhaustive message checking (as Tyrian has), could remove the crutch that is event filters, and pave the way to supporting other platforms.