Skip to content

Latest commit

 

History

History
30 lines (24 loc) · 628 Bytes

README.md

File metadata and controls

30 lines (24 loc) · 628 Bytes

Compatible-Storage

Support all browser and Wechat mini program. Quick to set, get and remove the storage.

Install

npm i -save compatible-storage
// or
yarn add compatible-storage

Import

import StorageUtils from 'compatible-storage';

Usage

// Set by default expire time. Default: 30 days.
StorageUtils.set('storage-key', { ...data...});

// Custom expire time. eg: 2 hours.
StorageUtils.set('storage-key', { ...data...}, new StorageUtils.Expire(2, StorageUtils.EXPIRE_UNIT.HOUR));

// Get
const value = StorageUtils.get('storage-key');

// Remove
StorageUtils.remove('storage-key');