Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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化
- Host: GitHub
- URL: https://github.com/axetroy/wxapp-promisify
- Owner: axetroy
- License: mit
- Created: 2017-06-22T06:17:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-08T12:43:48.000Z (almost 6 years ago)
- Last Synced: 2024-10-11T20:13:53.463Z (3 months ago)
- Topics: promise, promisify, wx, wxapp
- Language: JavaScript
- Homepage:
- Size: 103 KB
- Stars: 12
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: contributing.md
- License: LICENSE
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)