Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/axetroy/wxapp-promisify

微信小程序wx对象的API,promise化
https://github.com/axetroy/wxapp-promisify

promise promisify wx wxapp

Last synced: 3 months ago
JSON representation

微信小程序wx对象的API,promise化

Awesome Lists containing this project

README

        

# wxapp-promisify

[![Greenkeeper badge](https://badges.greenkeeper.io/axetroy/wxapp-promisify.svg)](https://greenkeeper.io/)
[![Build Status](https://travis-ci.org/axetroy/wxapp-promisify.svg?branch=master)](https://travis-ci.org/axetroy/wxapp-promisify)
[![Dependency](https://david-dm.org/axetroy/wxapp-promisify.svg)](https://david-dm.org/axetroy/wxapp-promisify)
![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/@axetroy/wxapp-promisify.svg)](https://badge.fury.io/js/wxapp-promisify)

让微信小城的对全局对``wx``的api返回promise.

对所有api增加Async后缀,则调用异步api,并且返回promise.

## Installation
```bash
npm install wxapp-promisify
```

## Usage

```javascript
// es6
import wx from '@axetroy/wxapp-promisify';

// commandJS
var wx = require('@axetroy/wxapp-promisify');

wx
.getUserInfoAsync()
.then(function(userInfo) {
console.log(userInfo);
})
.catch(function(err) {
console.error(err);
});

wx
.showToastAsync({ title: 'This is title' })
.then(function(res) {})
.catch(function(err) {});

```

```bash
git clone https://github.com/axetroy/wxapp-promisify.git
cd ./wxapp-promisify
yarn
```

You can flow [Contribute Guide](https://github.com/axetroy/wxapp-promisify/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-promisify/blob/master/LICENSE)