/wxapp-storage

简单的微信小程序Storage相关的封装, 特点是安全的数据源, 有效的存储时间

Primary LanguageJavaScriptMIT LicenseMIT

wxapp-storage

Greenkeeper badge Build Status Dependency License Prettier Node npm version

Git Package Manager, make you manage the repository easier

Installation

npm install @axetroy/wxapp-storage

Features

  • 存储绝大多数的数据类型(微信原生对象只支持object/string)
  • 设置有存储时限
  • 优雅的API

Usage

// usage
import Storage from '@axetroy/wxapp-storage';
const store = new Storage(wx);

store.set('userinfo',{
  username: 'axetroy',
  age: 'Forever Young'
});

console.log(store.get('userinfo'));

API

store.set(key:string, value:any, expiration:number):this

存储

store.get(key:string):any

store.remove(key:string):this

store.clear():this

Contributing

git clone https://github.com/axetroy/wxapp-storage.git
cd ./wxapp-storage
yarn

You can flow Contribute Guide

Contributors


Axetroy

💻 🔌 ⚠️ 🐛 🎨

License

The MIT License