You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment, context restore in Phaser happens when the browser signals it has been restored. We would like to control when this happens so that we can try to increase the chances that the context stays restored.
For example, we see that context losses mostly happen when the tab is in background and for some situations, it would restore only to immediately lose it again.
We would like to try to restore the Phaser WebGLRenderer when the tab is next active instead so it only happens once and perhaps the browser will prioritise resources to it now that it is focused.
The side effect is that errors can be thrown from Phaser during the restore process that we would like to try/catch and track for analytics and that's not possible with the current restore process.
As a potential PR, I was thinking about wrapping the webglcontextrestored and webglcontextlost event listeners in private functions that internally call contextRestoredHandler / contextLostHandler instead of it being the listener directly. Maybe even separate the renderer restore logic into a separate function so that it could be called by custom overrides.
The text was updated successfully, but these errors were encountered:
At the moment, context restore in Phaser happens when the browser signals it has been restored. We would like to control when this happens so that we can try to increase the chances that the context stays restored.
For example, we see that context losses mostly happen when the tab is in background and for some situations, it would restore only to immediately lose it again.
We would like to try to restore the Phaser WebGLRenderer when the tab is next active instead so it only happens once and perhaps the browser will prioritise resources to it now that it is focused.
The side effect is that errors can be thrown from Phaser during the restore process that we would like to try/catch and track for analytics and that's not possible with the current restore process.
As a potential PR, I was thinking about wrapping the
webglcontextrestored
andwebglcontextlost
event listeners in private functions that internally callcontextRestoredHandler
/contextLostHandler
instead of it being the listener directly. Maybe even separate the renderer restore logic into a separate function so that it could be called by custom overrides.The text was updated successfully, but these errors were encountered: