demo · v133

Freeze on Energy Saver

Wires up freeze / resume lifecycle events and a 250 ms heartbeat. Switch tabs (or trigger Energy Saver) and come back — the log shows when the tab was frozen by the browser and when it resumed.

heartbeats
0
visibility
freeze events
0

checking support…

the code

document.addEventListener("freeze", (e) => {
  // Persist URGENT state, you have ~500ms.
  localStorage.setItem("lastFrozen", String(Date.now()));
});
document.addEventListener("resume", () => {
  // Reconnect sockets, refresh stale UI.
});

see also