background-state

Installation
SKILL.md

Background State

Add background state persistence to an Even Hub plugin by analyzing its code and inserting setBackgroundState + onBackgroundRestore calls from @evenrealities/even_hub_sdk.

Background

The Even Hub host app uses a Headless WebView migration strategy when the phone goes to the background:

  1. inactive — host snapshots current JS state via window.__getStateSnapshot()
  2. paused — host creates a new HeadlessInAppWebView, loads the same plugin URL, and calls window.__restoreState(snapshot) to replay the saved state
  3. Background — the headless WebView runs invisibly, continuing to push frames to the glasses
  4. resumed — snapshot is injected into the foreground WebView before it wakes up, then the headless WebView is destroyed

If a plugin does not register any state exporters, __getStateSnapshot() returns '{}' and the headless WebView starts from scratch — causing the plugin to reset to its initial state every time the phone comes back from the background.

When to Use

Installs
35
GitHub Stars
43
First Seen
Apr 26, 2026
background-state — even-realities/everything-evenhub