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

hysdk

v1.2.7-beta

Published

Hy SDK

Downloads

6

Readme

简介

HySDK是Hy方案面向开发者提供的前端开发工具包。

通过使用HySDK,前端开发者可以高效的使用 分享拍照选图位置 等手机系统的能力,而不需要区分是页面是运行在Hy环境、微信或者浏览器环境。

同时根据业务需求,提供了 Qunar 插件(对 Qunar 业务逻辑进行适配)Fusion 插件(包含 Qunar 插件,同时支持 Ctrip Hybrid 方案),详细请见 插件说明

Demo 地址: http://ued.qunar.com/hy2/hysdk/demo/

引入

最新版本: 1.2.6

Node Module

核心版:

qnpm install @qnpm/hysdk

Qunar插件

qnpm install @qnpm/hysdk-qunar

Fusion插件

qnpm install @qnpm/hysdk-fusion

线上引用

对于一些时效性的活动和专题页面,可以直接通过线上地址引用资源进行使用。(正常项目须在项目中安装并与项目代码核心打包)

核心版:

http://q.qunarzz.com/hysdk/prd/[email protected]

Qunar插件

http://q.qunarzz.com/hysdk/prd/plugins/[email protected]

Fusion插件

http://q.qunarzz.com/hysdk/prd/plugins/[email protected]

使用

配置

// 引入 HySDK
require('@qnpm/hysdk');
// 引入 插件
require('@qnpm/hysdk-fusion');

// 配置并初始化 (在使用HySDK前必须config)
hysdk.config({
    "debug": false, /* 调试开关 */
    "bridgeReadyEvent": "WebViewJavascriptBridgeReady", /* Hytive 桥 Ready 事件 */
    "bridgeReadyTimeout": 600, /* 桥 Ready 最大延迟 */
    "hytiveReg": "(^|\\s)(qunar[^\\/]+)\\/([\\d\\.]+)", /* Hytive UA 判断正则 */
    "wechatSupport": false, /* 是否支持微信 */ /* qunar/fusion 版本默认为 true,使用去哪儿网公共号 */
    "wechatScriptUrl": "//res.wx.qq.com/open/js/jweixin-1.0.0.js", /* 微信 JSSDK 地址 */
    "wechatSignatureUrl": "//ccweixin.qunar.com/chat/getJsConfig.do", /* 微信签名服务地址 */ /* qunar/fusion 版本默认配置 */
    "ucAPIScriptUrl": "//common.qunarzz.com/buri/prd/scripts/api/[email protected]" /* ucAPI 脚本地址 */ /* qunar/fusion 版本默认配置 */
});

调用

hysdk.getLocation({
    timeout: 5000,
    success: function() {
        // TODO Something
    },
    fail: function() {
        // TODO Something
    },
    complete: function() {
        // TODO Something
    }
});

更多 API 请参见 API 文档;

其他问题

扩展

HySDK 同时也提供了 hysdk.ctrip.jshysdk.webViewJavascriptBridge.js,前者是提供给 Ctrip Lizard 框架使用的,后者是用于老业务(基于 QunarAPI 或者直接使用 webViewJavascriptBridge 的)适配 Ctrip 客户端的方案,在 Qunar Hy 方案中正常运行的项目,在前端代码最前面引入 hysdk.webViewJavascriptBridge.js 即可完成对 Ctrip 客户端的适配。如果想详细了解,请联系开发者。

微信签名服务

在这里特别呼谢 CallCenter 的同学,提供了 //ccweixin.qunar.com/chat/getJsConfig.do Qunar 公共的微信签名 API,使业务可以方便在微信内调用其 API。在 HySDK 已经默认配置了此接口,开发者的页面在微信浏览器里会使用 去哪儿网 公共号的权限调用微信 API。当然接口有域名限制,只有 *.qunar.com 域才可以。具体文档 点击查看(内网)。

开发者信息