maxdata
v0.1.2
Published
Object synced to IndexedDB.
Maintainers
Readme
MAXDATA
MAXDATA gives you a magic object, which behaves like a normal JavaScript object,
but it automatically syncs to IndexedDB.
USAGE
npm install maxdataimport { maxdata, setupMaxdata } from "maxdata";
await setupMaxdata();
// All actions are auto synced to indexedDb
maxdata.user = { name: "peter", theme: "dark" };
maxdata.user.theme = "light";setupMaxdata()
Call it at your app start. It setup the IndexedDB and loads data to memory.
Features
- Proxy-based deep reactivity
- Automatic persistence to IndexedDB
- Debounced writes using microtasks
- Safe handling of normal objects and arrays
- Minimal API
- No external dependencies
How it works
MAXDATA keeps an in-memory cache and mirrors it into IndexedDB.
- Root values are cloned before storage
- Plain objects and arrays are wrapped in
Proxy - Nested mutations trigger persistence for the root key
- Writes are queued in a microtask to avoid flooding IndexedDB transactions
Limitations
- Only plain objects and arrays are reactive
- Persistence is organized by root key, not by nested path
- IndexedDB must be available in the environment
- This is a lightweight storage layer, not a full state-management framework
License
MIT
