@visitor-analytics-sdk/storage
v1.0.1
Published
Storage adapters for the visitor-analytics SDK — memory, localStorage, and IndexedDB backends with a common interface.
Downloads
286
Maintainers
Readme
@visitor-analytics-sdk/storage
Storage adapters for the visitor-analytics SDK — memory, localStorage, and IndexedDB backends with a common interface.
npm install @visitor-analytics-sdk/storageAdapters
| Adapter | Persistence | Multi-tab |
|---|---|---|
| MemoryStorage | Session only | No |
| LocalStorageAdapter | Persistent | No |
| IndexedDBAdapter | Persistent | Yes (recommended) |
Usage
import { StorageAdapterFactory } from "@visitor-analytics-sdk/storage";
const storage = StorageAdapterFactory.create("indexeddb");
await storage.save(record);
const records = await storage.load();Auto-detection selects the best available backend:
StorageAdapterFactory.createAuto(); // indexeddb > localstorage > memoryLicense
MIT
