Zero dependencies · Vanilla JS · 2kb

The browser
never forgets.

Kill a tab. Reopen it. Pick up exactly where you left. Tabs as processes. IndexedDB as memory. Nothing is lost.

See it live → Process isolation test

Drop in. Two lines.

<script src="https://cdn.jsdelivr.net/gh/edmundsparrow/gnoke-spirit/gnoke-spirit.js"></script>
<script> gnokeSpirit.wake(); </script>
// That's it. Your tab now survives death.

How it works

01
User types
Spirit watches input events, throttled at 300ms. State written silently to IndexedDB.
02
Tab is killed
OS clears memory. A final snapshot fires on visibilitychange before the process dies.
03
Tab reopens
Spirit reads IndexedDB before first paint. Scroll, fields, and focus restored instantly.
04
User continues
No flicker. No prompt. No lost work. Indistinguishable from a native app.

API

gnokeSpirit.wake(pid?, form?) Start the spirit. Restores last state immediately. pid defaults to location.pathname — each route is its own process.
gnokeSpirit.kill(pid?) Wipe process memory. Pass a custom pid or leave blank to wipe the current tab's process.
gnokeSpirit.list() Returns all active process IDs. Your process table. Useful for building tab managers or dashboards.

What is and isn't persisted

StatePersistedReason
Text inputs & textareasYesSafe user content
Scroll positionYesSafe positional state
Active field focusYesSafe UX context
Select valuesYesSafe user preference
PasswordsNeverSecurity — always excluded
Tokens & secretsNeverSecurity — always excluded
Auth / session stateNeverNot our concern — by design