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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ls-jsbridge

v1.0.3

Published

ls-jsbridge

Readme

JSBridge

H5和客户端之间使用到的桥接封装

Basic Usage

npm install ls-jsbridge -S
or
yarn add ls-jsbridge
import JSBridge from 'ls-jsbridge';

或者

<script src="./dist/JSBridge.js"></script>

页面加载时调用

JSBridge.init({
  debug: false,
  onready: function () {
    JSBridge.getUid({}, function (res) {
      // 处理res
    });
  }
});

init

| 参数 | 解释 | 默认 | | :-----: | :-----: | :----: | | debug | 打开时可看到更多调试信息 | false | | onready | init成功后的回调 | null |

普通调用

JSBridge.getUid({}, function (res) {
  // 处理res
});

方法

| 方法名 | 解释 | 返回值类型 | 备注 | | :-----: | :-----: | :----: | :----: | | getUid | 获取当前用户uid | Number | 封装前的类型是不一样的,做了特殊处理,单独使用时需要注意 | | getToken | 获取token | String | 原生定义的方法名不一样,安卓叫getUserToken | | openWeChat | 打开微信客户端 | undefined | ios无返回值 | | follow | 关注/取消关注 | undefined | ios无返回值,接受两个参数,点击查看 | | getParams | 获取公共参数 | string | ios无返回值,私信发的链接能正常返回,安卓返回空string | | closeWebPage | 关闭当前webview | undefined | ios无返回值,都没有效果 | | share | 分享 | undefined | ios无返回值,接受参数,点击查看 | | | hasVip | 是否是特权版本 | string | 值为'{ "has_vip": 1 }' |

follow

| 参数 | 是否必须 | 解释 | 类型 | 备注 | | :-----: | :-----: | :----: | :----: | :----: | | hasFollow | 是 | 是否已经关注 | Boolean | false为关注,true为取消关注 | | uid | 是 | 用户id | Number | |

share

| 参数 | 是否必须 | 解释 | 类型 | 备注 | | :-----: | :-----: | :----: | :----: | :----: | | shareType | 是 | 类型 | Number | QQ-0 微信-1 微博-2 QQ空间-3 朋友圈-4 | | title | 是 | 标题 | String | | | content | 是 | 描述 | String | | | imgUrl | 是 | 图标 | String | | | url | 是 | 分享地址 | String | |

关于文件的一些说明

index.js是作为依赖的入口

src/index.js作为编译成dist文件夹下面文件的入口

lib/index.js是主要的逻辑文件