ump-plugin-storage
v0.0.1
Published
UMP Storage Plugin - Async key-value storage for UMP apps
Downloads
5
Readme
ump-plugin-storage
UMP Storage Plugin — async key-value storage that persists across app launches.
Install
npm install ump-plugin-storage --save
Usage
import { Storage, storagePlugin } from 'ump-plugin-storage';
pm.register(storagePlugin({ prefix: 'myapp' }));
await Storage.setItem('user.token', 'abc123'); const token = await Storage.getItem('user.token'); await Storage.removeItem('user.token'); await Storage.clear(); // clears only the prefix range
Backed by __ump_storage_* host functions registered by the runtime
(see runtime/reconciler/js_bridge.cpp). When the native bridge is
missing — e.g. a harness that loads the JS plugin without the runtime —
the plugin falls through to an in-process Map and emits a one-shot
console.warn. The fallback honours the public Storage contract but is
process-scoped: data is lost on app exit.
For the non-persistent variant (always in-memory, clears on exit) see
ump-plugin-session-storage.
See src/index.ts for the full API.
Plugin authoring
This is a UMP plugin. See docs/superpowers/specs/plugin-authoring-guide.md for the plugin model.
