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

@mxnet/wechatpublicaccounthelper

v0.2.5

Published

weChat public account helper,实现公众号在本地开发的polyfill

Downloads

3

Readme

weChatPublicAccountHelper

TODO: description

flow chart

每个 api 通过继承 ApiImplementation 获取读写 api 配置,wechat SDK api 常用回调封装

并通过 api.done() 来完成调用

期间会判断当前环境是否注入 wechat sdk

wechat sdk 不存在时

会调用 根据 api polyfill 的预期行为, 该预期行为属于无 wechat sdk 时模拟 wechat sdk的预期行为

预期行为会返回 succces 的预期参数 并 call success callback

wechat sdk 存在时

将会把 api.readConfiguration({}) 获取的所有参数传递给 wechat sdk,你仍然可以通过api.success(()=>{})等回调跟踪 wechat sdk 的行为

Usage

cjs

const wechatpublicaccounthelper = require("weChatPublicAccountHelper");

esm

import * as wechatpublicaccounthelper from "wechatpublicaccounthelper";
import { ChooseImage } from "wechatpublicaccounthelper";

umd

<script src="./dist.umd"></script>
<script>
  new weChatPublicAccountHelper.GetLocalImgData().done();
</script>

common use

<script src="./dist.umd"></script>
<script>
  // 配置 weChatPublicAccountHelper
  new weChatPublicAccountHelper.BasicConfiguration({
    // 该baseSrc会在无 wechat sdk 的情况下,在部分api success 参数需要 图片 url 链接 的情况下返回 (如 GetLocalImgData)
    baseSrc: "abd",
  });
  new weChatPublicAccountHelper.GetLocalImgData()
    .success((res) => {
      // 该 res 和 wechat sdk 返回的数据结构兼容
      console.log(res.localData === "abd");
    })
    .done();
</script>
<script src="./dist.umd"></script>
<script>
  // 以下 api 代之 wechat sdk api
  new weChatPublicAccountHelper.api()
    // wechat sdk succscc callback
    .success(() => {})
    // wechat sdk fail callback
    .fail(() => {})
    // wechat sdk complete callback
    .complete(() => {})
    // wechat sdk cancel callback 此回调只在部分 api 中存在
    .cancel(() => {})
    // wechat sdk trigger callback 此回调只在部分 api 中存在
    .trigger(() => {})
    // 该函数的参数会传入 wechat sdk api 中
    .readConfiguration({})
    .done();
</script>