wxpromisefy

npm install --save wxpromisefy

Usage no npm install needed!

<script type="module">
  import wxpromisefy from 'https://cdn.skypack.dev/wxpromisefy';
</script>

README

Project setup

npm install --save wxpromisefy

Getting started

请开启 增强编译,以支持使用Array.prototype.includes等ES7的新特性

example:

const { wxpromisefy, wxpromisefyAll } = require('wxpromisefy')
//将wx的api全部promise化
wxpromisefyAll()
wx.showModal({
    title: '测试'
}).then(() => {
    wx.showToast('promise测试')
})

//单个api实现promise化
wxpromisefy(wx.getSystemInfo)().then(...)