1.0.7 • Published 6 months ago

lyc-storage v1.0.7

Weekly downloads
-
License
Apache
Repository
-
Last release
6 months ago

lyc-storage

包简答说明

这是一个对浏览器本地存储二次封装的库,支持过期与加密

使用例子

//以上初始化一个localstorage,进行加密,密钥是lyc
import { initStorage } from "lyc-storage"

const storage = initStorage("local",{
   isCrypto: true,
   sercetKey: 'lyc'
})

//存储,maxAge代表最大存在时间,maxAge是一个可选的参数
storage.set(key,value,maxAge)
//获取
storgae.get(key)
//删除
storage.remove(key)
//清除所有存储
storage.clear();
//获取已经使用的内存
storage.getSize();

//也可以不传入参数,默认创建一个localstorage,不加密
const sotrage = initStorage()
//也可以解构使用
const { get,set,remove,clear,getSize } = initStorage();
//用法与上面一样
set(key,value,maxAge)
get(key)
remove(key)
clear();
getSize()
1.0.7

6 months ago

1.0.6

6 months ago

1.0.5

6 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago