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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mpxjs/webview-bridge

v2.11.3

Published

a bridge for mpx webview

Readme

@mpxjs/webview-bridge

为跨小程序平台提供通用的webview-bridge

Usage

抹平了各端JSSDK方法调用逻辑,统一挂载在webviewBridge对象上提供调用

import webviewBridge from '@mpxjs/webview-bridge'
const { navigateBack, postMessage } = webviewBridge
postMessage({
  data: 'test',
  success (res) {
    console.log('postmessage成功回调, 结果:', res)
  }
})
navigateBack()

各端支持情况说明

  • 微信小程序:

    提供可调用方法参考微信web-view组件 JSSDK提供能力

    jssdk接口1 提供的方法直接调用即可(参考Usage示例)

    jssdk接口2 提供的方法需要传入config配置后再调用,webview-bridge提供了对应的config方法,该方法只在微信小程序环境下生效,使用示例如下:

    import webviewBridge from '@mpxjs/webview-bridge'
    // 具体传入配置参考微信说明
    webviewBridge.config({
      debug: true,
      appId: '',
      timestamp: '',
      nonceStr: '',
      signature: '',
      jsApiList: []
    })
    // wx.ready在框架内部抹平,直接调用方法即可
    webviewBridge.updateAppMessageShareData({ 
      title: '',
      desc: '',
      link: '',
      imgUrl: '',
      success: function () {
      }
    })
  • 支付宝、百度、QQ、抖音小程序:

    支持各小程序web-view组件 JSSDK提供的方法,直接调用webviewBridge上挂载的对应方法即可(参考Usage示例)

    ::: warning 各小程序接口1以外的方法提供的不尽相同,在支持多小程序运行的h5调用中,建议调用非通用的方法时,增加判空的容错处理 :::

  • webapp:

    微信jssdk接口1 提供的方法可以直接调用webviewBridge上挂载的对应方法(参考Usage示例)

    微信jssdk接口2 提供的方法目前只支持getLocation方法的调用

    • getLocation方法使用介绍:

      小程序转webapp的项目本身没有getLocation的能力,需要在webapp属主中增加getLocation的方法挂载,挂载示例如下:

         // webapp app.web.js
          ...
          mpx.config.webConfig.webviewConfig = {
              // 必须在webapp进行挂载否则h5中调用不到getLocation的返回
              apiImplementations: {
                  getLocation () {
                      // 提供一个异步的方法
                  }
              }
          }
          ...