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

easy-weixin

v1.0.7

Published

a lib for weixin web auth and js-sdk

Downloads

13

Readme

easy-weixin

对于jssdk的调用,可以在初始化的时候封装一层promise,在方法调用的时候封装一层promise,这样可以将配置和调用解耦,通过then控制时序。

wxAuthInit({
    appid: 'wx9e3db1dfe14a2868', // 您的微信appid
    responseType: 'code',  // 返回类型,请填写code
    scope: 'snsapi_userinfo', // 应用授权作用域,snsapi_base (不弹出授权页面,直接跳转,只能获取用户openid),snsapi_userinfo (弹出授权页面,可通过openid拿到昵称、性别、所在地。并且,即使在未关注的情况下,只要用户授权,也能获取其信息)
    next: next,
    getCodeCallback(code, goNext) {
        console.log(code)
        store.dispatch('requestOpenId', code)
        goNext()
        // alert(code)
    }
})
getLocation() {
  wxJsInit({
    appId: 'wx9e3db1dfe14a2868',
    timestamp: '1533950225',
    nonceStr: '104239041ba34ab2',
    signature: '656f4118411b8728ad3ad1bef3e286d26a5e198d',
  }).then((res) => {
      return wxJsMethodCall('getLocation', {
        type: 'wgs84'
      })
    }
  ).then(function(data) {
    console.log(data)
    let latitude = data.latitude
    let longitude = data.longitude
    if (longitude != null && latitude != null) {
      console.log('位置信息:', longitude + ':' + latitude)
      // callback && callback(longitude, latitude)
    } else {
      console.log('获取地理位置信息失败请重试')
    }
  }).catch(e => {
    console.log(e)
  })
}