Keep the browser window running while not-active


I’m developing a rather large game (100k LoC) in Phaser and it’s an Action RPG MMO. I am loving Electron!

There is one problem though and was wondering if you guys know how I can solve it.

When you minimize the browser window it seems like the browser windows halts all execution.

I was wondering if there is a setting for electron that disables this and keeps the code running while the electron window is not-active. For Phaser, the game engine I am using, there is this:
And I do have it set to true, but it also says

Note that the browser can still elect to pause your game if it wishes to do so, for example swapping to another browser tab. This will cause the RAF callback to halt, effectively pausing your game, even though no in-game pause event is triggered if you enable this property.

So, is this maybe a Chromium issue with RequestAnimationFrame? Or a setting that maybe electron can fix?

Avoid app throttling when Electron is in background

Hey guys, I found a solution:

Using the win.setMinimizable(minimizable) option and setting it to false works! It keeps RAF running even when the game is minimized (by using Windows+D Key). But I am not sure if this is intended or not :stuck_out_tongue: I hope it’s not though because for my game, I really need RAF to be running 24/7. But this seems like a fix for now!


This is a duplicate of a previous topic:

Also in that topic there is a non-hacky solution to your question :wink:

We like to unify similar discussions under one topic so that people don’t have to read a bunch of different threads to get the whole story. Please continue the discussion there. I’ll be closing this topic as duplicate.

closed #4

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.