Table of Contents

Class WebGLPageLifecycle

Namespace
FishMMO.Client
Assembly
FishMMO.Client.dll

Tells the client when the browser page stops being visible, which on a web build is the last reliable chance to write anything to disk.

public static class WebGLPageLifecycle
Inheritance
WebGLPageLifecycle
Inherited Members

Remarks

Why this exists. A WebGL build gets no OnApplicationQuit when the tab is closed, and the frame loop stops the moment the page is hidden, so a save that is waiting on a debounce in Update never comes due. The explored map lost every chunk walked since its last write that way. PageHidden is raised synchronously from the page's visibilitychange/pagehide handler, and the handler persists the IndexedDB mount straight after it returns — see FishMMORegisterPageHidden in WebGL.jslib.

Fires more than once per close, and on every tab switch. Handlers must be cheap and idempotent: flush what is dirty, do nothing when nothing is.

Everywhere else this never fires. A desktop build has OnApplicationQuit and an editor has neither a page nor IndexedDB, so subscribing needs no platform guard.

Events

PageHidden

Raised when the page is hidden or being unloaded. Runs outside the frame loop.

public static event Action PageHidden

Event Type

Action