npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wechat-jssdk-promise

v1.0.0

Published

wechar jssdk promise wrapper

Downloads

1

Readme

#微信JSSDK Promise版本 微信JSSDK使用回调函数进行异步处理,但是某些接口会存在“回调嵌套”的问题,比如【播放一个服务器的录音文件】,需要:

  1. wx.downloadVoice
  2. wx.playVoice 本程序对微信JSSDK进行的一层Promise包装,配合ES7的async/await可以解决此类问题 ##注意
  3. 本程序依旧依赖微信JSSDK的js,请提前加载
  4. 微信原始JSSDK中的方法依旧可以使用
    ##异步接口
  • wx.config => wx.configAsync
  • wx.checkJsApi => wx.checkJsApiAsync
  • wx.onMenuShareTimeline => wx.onMenuShareTimelineAsync
  • wx.onMenuShareQQ => wx.onMenuShareQQAsync
  • wx.onMenuShareWeibo => wx.onMenuShareWeiboAsync
  • wx.onMenuShareQZone => wx.onMenuShareQZoneAsync
  • wx.chooseImage => wx.chooseImageAsync
  • wx.previewImage => wx.previewImageAsync
  • wx.uploadImage => wx.uploadImageAsync
  • wx.downloadImage => wx.downloadImageAsync
  • wx.startRecord => wx.startRecordAsync
  • wx.stopRecord => wx.stopRecordAsync
  • wx.onVoiceRecordEnd => wx.onVoiceRecordEndAsync
  • wx.playVoice => wx.playVoiceAsync
  • wx.pauseVoice => wx.pauseVoiceAsync
  • wx.stopVoice => wx.stopVoiceAsync
  • wx.onVoicePlayEnd => wx.onVoicePlayEndAsync
  • wx.uploadVoice => wx.uploadVoiceAsync
  • wx.downloadVoice => wx.downloadVoiceAsync
  • wx.translateVoice => wx.translateVoiceAsync
  • wx.getNetworkType => wx.getNetworkTypeAsync
  • wx.getLocation => wx.getLocationAsync
  • wx.startSearchBeacons => wx.startSearchBeaconsAsync
  • wx.stopSearchBeacons => wx.stopSearchBeaconsAsync
  • wx.onSearchBeacons => wx.onSearchBeaconsAsync
  • wx.scanQRCode => wx.scanQRCodeAsync
  • wx.chooseCard => wx.chooseCardAsync
  • wx.addCard => wx.addCardAsync
  • wx.chooseWXPay => wx.chooseWXPayAsync ##使用方法
    以 wx.chooseImage 为例
//使用wx.config
wx.config({
  //...
});
wx.ready(function() {
  //ready
});
wx.error(function(res) {
  //error
});
//可以看到非常繁琐
//使用wx.configAsyn
async function config() {
  try{
    await wx.configAsync({
      //...
    });
  }catch (e){
    //console.error(e.message);    
  }
}

##授权协议
MIT License ##博客
每天进步一点点