sealui-storage

1.1.1 • Public • Published

sealui-storage

localStorage 整合了过期时间的功能.

sealui-storage 同时支持 localStoragesessionStorage

如何使用

npm install sealui-storage

import storage from 'sealui-storage'
storage.save('key', 'value', time)

sealui-storage 返回一个 Promise

storage.save('key', 'storage', 3000).then(res => {
  console.log(res)
}).catch(err => {
  console.log(res)
})

storage.get('key').then(res => {
  console.log(res)
}).catch(err => {
  console.log(res)
})

API

save

存储到localStorage中

storage.save(key, value, time)

get

获取localStorage中指定键的值

storage.get(key)

remove

删除localStorage中指定键

storage.remove(key)

clear

清空localStorage

storage.clear(

Package Sidebar

Install

npm i sealui-storage

Weekly Downloads

1

Version

1.1.1

License

MIT

Unpacked Size

42 kB

Total Files

8

Last publish

Collaborators

  • bobo.xiao