wx-promise

just make official jssdk return a promise

Usage no npm install needed!

<script type="module">
  import wxPromise from 'https://cdn.skypack.dev/wx-promise';
</script>

README

Introduction

The traditional wechat jssdk coding style is not convenient, as below:

wx.ready(function() {
  wx.getNetworkType({
      success: function (res) {
          var networkType = res.networkType; // 返回网络类型2g,3g,4g,wifi
          //...
      }
  });
})

This project make each wechat jssdk function return a promise.Now you write like as below ( only one line ) :

// ES7
const {networkType} = await wx.getNetworkType()

Build Setup

# build for publish
make build

# run unit tests
make test