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

anxin-dsbridge

v1.0.0

Published

description

Downloads

11

Readme

@anxin/dsbridge

# 安装
npm install @anxin/dsbridge --save --registry=http://172.16.101.98:4873

使用

import bridge from "@anxin/dsbridge";

const callBridge = (options) => {
  const isApp = Boolean(
    window._cjDsBridge ||
      window._cjDswk ||
      navigator.userAgent.indexOf("_cjDsBridge") != -1
  );
  const { name, params, success, fail } = options;

  if (isApp) {
    bridge.call(name, params || {}, res => {
      console.log(name + " success");
      success && success(res);
    });
  } else {
    console.log(name + " fail");
    fail && fail();
  }
}

// 调用
callBridge({
  name: "getUserInfo",
  params: null,
  success: function(res) {
    console.log("success:", res);
  },
  fail: function(res) {
    console.log("fail:", res);
  }
});

跟据dsbridge源码(https://github.com/wendux/DSBridge-Android/tree/master/dsbridge/npm)改造

修改部分说明:

/**
 * create by 2021-04-08
 * 
 * 因为之前jsbridge非常混乱:
 * 1. 前端已经有 xBridge(源起于记加班,没有源码,地址: https://cdn.julanling.com/h5/libs/xBridge.js)
 * 2. 2020-12-30开始,客户端同学云人事app 添加B/C端需求,同时B/C端登录的 webview 完全不同,并完全隔离:
 *    C 端登录之后,webview 用之前的 xBridge
 *    B 端登录之后,webview 用之前的 dsbridge
 * 
 * 在一堆大神猛如虎的操作之后,造成如今场面------重构
 * 安卓同学源于记加班的恐惧,强烈要求对dsbridge进行如下改造,
 * 
 * 基于 dsbridge 3.1.4 改造 (https://github.com/wendux/DSBridge-Android/tree/master/dsbridge/npm)
 * 改造:
 * 1. _dsbridge 改为 _cjDsBridge
 * 2. _dsb 改为 _cjDsb
 * 3. _hasJavascriptMethod 改为 _cjHasJavascriptMethod
 * 4. dscb 改为 _cjDscb
 * 5. _dswk 改为 _cjDswk
 * 6. _dsaf 改为 _cjDsaf
 * 7. _dsf 改为 _cjDsf
 * 8. _dsInit 改为 _cjDsInit
 * 9. dsBridge 改为 cjDsBridge
 * 10. close 改为 _cjClose
 * 11. _handleMessageFromNative 改为 _cjHandleMessageFromNative
 * 12. _handleMessageFromNative 为兼容客户端,仍然保留着
 */