@deepjs/uni-storage

0.3.8 • Public • Published

uni-storage

封装 uni-app 的 storage,同步取,异步存,API 简单

独立包,无依赖,语义化,使用简单

功能列表

  • set(key, value, time = 3600) // time 单位秒,默认 1h
  • get(key) // 无则返回 undefined
  • remove(key) // 删除
  • clear(bool) // 清除 storage,传 true 则清除所有类型的缓存

使用

import storage from '@deepjs/uni-storage'

// 也可以直接挂载到 Vue 上
Vue.use(storage)

storage.set('name', 'cloudyan', 5);
storage.get('name');

setTimeout(() => {
  storage.get('name');
  storage.remove('name');
  storage.clear('name');
}, 6000);

Readme

Keywords

Package Sidebar

Install

npm i @deepjs/uni-storage

Weekly Downloads

0

Version

0.3.8

License

MIT

Unpacked Size

5.28 kB

Total Files

3

Last publish

Collaborators

  • cloudyan