Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/axetroy/wxapp-storage
简单的微信小程序Storage相关的封装, 特点是安全的数据源, 有效的存储时间
https://github.com/axetroy/wxapp-storage
storage wx wxapp
Last synced: 16 days ago
JSON representation
简单的微信小程序Storage相关的封装, 特点是安全的数据源, 有效的存储时间
- Host: GitHub
- URL: https://github.com/axetroy/wxapp-storage
- Owner: axetroy
- License: mit
- Created: 2017-05-17T04:03:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-08T12:52:37.000Z (over 5 years ago)
- Last Synced: 2024-04-14T01:45:56.798Z (7 months ago)
- Topics: storage, wx, wxapp
- Language: JavaScript
- Size: 124 KB
- Stars: 14
- Watchers: 1
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: contributing.md
- License: LICENSE
Awesome Lists containing this project
README
# wxapp-storage
[![Greenkeeper badge](https://badges.greenkeeper.io/axetroy/wxapp-storage.svg)](https://greenkeeper.io/)
[![Build Status](https://travis-ci.org/axetroy/wxapp-storage.svg?branch=master)](https://travis-ci.org/axetroy/wxapp-storage)
[![Dependency](https://david-dm.org/axetroy/wxapp-storage.svg)](https://david-dm.org/axetroy/wxapp-storage)
![License](https://img.shields.io/badge/license-MIT-green.svg)
[![Prettier](https://img.shields.io/badge/Code%20Style-Prettier-green.svg)](https://github.com/prettier/prettier)
![Node](https://img.shields.io/badge/node-%3E=6.0-blue.svg?style=flat-square)
[![npm version](https://badge.fury.io/js/%40axetroy%2Fwxapp-storage.svg)](https://badge.fury.io/js/%40axetroy%2Fwxapp-storage)Git Package Manager, make you manage the repository easier
## Installation
```bash
npm install @axetroy/wxapp-storage
```## Features
- [x] 存储绝大多数的数据类型(微信原生对象只支持object/string)
- [x] 设置有存储时限
- [x] 优雅的API## Usage
```javascript
// 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
```bash
git clone https://github.com/axetroy/wxapp-storage.git
cd ./wxapp-storage
yarn
```You can flow [Contribute Guide](https://github.com/axetroy/wxapp-storage/blob/master/contributing.md)
## Contributors
| [
Axetroy](http://axetroy.github.io)
[💻](https://github.com/gpmer/gpm.js/commits?author=axetroy) 🔌 [⚠️](https://github.com/gpmer/gpm.js/commits?author=axetroy) [🐛](https://github.com/gpmer/gpm.js/issues?q=author%3Aaxetroy) 🎨 |
| :---: |## License
The [MIT License](https://github.com/axetroy/wxapp-storage/blob/master/LICENSE)