storage-hub
v0.3.1
Published
一个web本地存储工具
Downloads
1
Readme
storage-hub
一个web本地存储工具
install
npm i storage-hub
examples
basic
import StorageHub, { LocalStorageProvider, MemoryStorageProvider } from 'storage-hub';
type StoreKV = {
name: string;
age: number;
favorite?: Record<string, any>[];
}
const myStorageHub = new StorageHub<StoreKV>(new LocalStorageProvider);
myStorageHub.setItem('name', 'lily');
myStorageHub.setItem('age', 10);
myStorageHub.setItem('favorite', [{ type: '😄'}], { expires: 24 * 60 * 60 * 1000 });