Pausing the game when losing focus

The game continues to play when focus is lost. This includes BGS/BGM, event movement, maybe event interaction (on-map enemy set to approach - I haven't tested this yet), and the playtime counter (and maybe the game timer - also not tested).

I had a quick search but all I could see was questions, and most of those were for Ace.

Is there a way to completely pause the game when the window loses focus? I don't mind writing something (which is why I posted in js support), but I have no idea where to begin looking for the focus lost / focus gained triggers.
Does Zalerinian's GameFocus plugin still work? I found it in my MV install directory under dlc/RPGmakerWeb_plugins/Zalerinian or here: http://mvplugins.com/plugin/Zalerinian/GameFocus
Thanks - I'll check it out. If it works, it might be exactly what I need, though maybe with a few additions.

Edit: crumbs - it has dependencies on other plugins. And no terms of use in the script. But I see the couple of lines that I was looking for, for the trigger to lose/gain focus, so I should be able to - slowly - build something now.
Oh, didn't think of that. At least you can use the code as a basis, though! =)
yeah, the main thing I needed to know was "how do I tell when the game's lost or regained focus?" - I'm not surprised it's part of the document class. That's all a bit alien to me as I've only used js in the MV context, within the actual game scripts, not the container that holds it all together.

Original thread: https://forums.rpgmakerweb.com/threads/pausing-the-game-when-losing-focus.92269/