Browser storage plugin for Svelte and Pinia that simplifies integration with localStorage and IndexedDB via localforage. Version 2.0.2 is current, with no recent release cadence indicated. Key differentiators include configurable encryption, key expiration with timeout, chain expiry, and dedicated functions for Svelte stores and Pinia stores. Supports ESM imports but lacks TypeScript definitions.
npm install spa-storageNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes localforage for IndexedDB storage, sets up a Svelte writable store with custom storage key, and demonstrates saving/loading store data to/from browser storage.
Add `declare module 'spa-storage'` in a global .d.ts file.
Pass a callback function as first argument or await initialization.
Call `spaStorage.setEncryptionKey('your-key')` before using encrypted operations.Manually merge existing data before saving if partial update needed.
Ensure `spaStorage.startForage()` is called early in application bootstrap before any storage operation.
Run `npm install localforage` and verify it is in node_modules.
Use named import: `import { svelteFunctions } from 'spa-storage'`.