小程序异步方法已支持Promise的then回调miniprogram-api-promise怎用?

发布于 7 年前作者 taoyong7168 次浏览最后编辑 7 年前来自 ask

微信提供了一个将异步API Promise化的库miniprogram-api-promise,我发现现有的小程序异步api就已经支持then写法了啊;这个工具的意义是什么?文档写的很简略;

  wx.getSystemInfo().then(res => console.log(res))   //获取成功
1 回复
qiangdu
qiangdu1 楼4 年前

如果你调用的wx.xxxx文档里,发现不支持Promse的,需要这个库。比如: