安装
npm install good-storage
用法
import storage from 'good-storage'
// localStorage
storage.set(key,val)
storage.get(key, def)
// sessionStorage
storage.session.set(key, val)
storage.session.get(key, val)
API
- set storage with key and val
set(key, val) - get storage with key, return def if not find
get(key, def) - remove storage with key
remove(key) - determine storage has the key
has(key) - clear all storages
clear() - get all the storages
getAll() - forEach the storages and call the callback function with each storage
forEach(callback)






网友评论