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

js-and-native-bridge

v0.0.3

Published

js原生交互

Downloads

3

Readme

jsAndNativeBridge

该插件用于h5和原生交互

方法一:下载

npm i js-and-native-bridge -S 或 yarn add js-and-native-bridge

使用

import jsBridge from 'js-and-native-bridge'

方法二:引入

<script src="./index.js"></script>

方法列表

|方法|说明|参数|示例|备注| |---|---|---|---|---| |actionEvent|跳转内容页面|(页面pagekey,页面参数)|jsBridge.actionEvent('5b599d5492cb320af89ef83a',{id:1})|第二个参数选填| |jumpNewPage|跳转外链|外链url|jsBridge.jumpNewPage('http://www.baidu.com')|| |setTitleText|设置页面顶部标题|标题文字内容|jsBridge.setTitleText('个人中心')|| |goChat|发起聊天|(对方用户uid,对方用户pid)|jsBridge.goChat(1,2)|| |setUserInfo|保存用户信息|用户信息|jsBridge.setUserInfo({name:'Tom',sex:'1'})|| |upLoadImage|上传图片|回调函数|jsBridge.upLoadImage((data)=>{})|回调函数返回值为图片链接| |getNavibarColor|获取顶部导航颜色|回调函数|jsBridge.getNavibarColor((data)=>{})|回调函数返回值为顶部导航颜色| |getSearchHistory|切换项目时获取APP搜索历史|回调函数|jsBridge.getSearchHistory((data)=>{})|回调函数返回值为APP搜索历史| |switchProject|传递项目信息,切换项目|项目信息|jsBridge.switchProject({id:1})|| |addToScreen|传递项目信息,添加到桌面|项目信息|jsBridge.addToScreen({id:1})|| |getParam|获取页面参数信息|(页面pagekey,回调函数)|jsBridge.getParam('5b599d5492cb320af89ef83a',(data)=>{})|回调函数返回值为页面参数信息| |logout|退出登录||jsBridge.logout()|| |checkUpdate|检查APP是否有新版本||jsBridge.checkUpdate()|| |getVersion|获取APP当前版本号|回调函数|jsBridge.getVersion((data)=>{})|回调函数返回值为APP当前版本号| |goFinish|返回上一页|弹出的提示信息|jsBridge.goFinish('已返回')|参数选填| |goFinishRefresh|返回上一页并刷新上一页|弹出的提示信息|jsBridge.goFinishRefresh('已返回上一页并刷新')|参数选填| |setRefresh|刷新当前页面||jsBridge.setRefresh()|| |getUid|获取当前用户id|回调函数|jsBridge.getUid((data)=>{})|回调函数返回值为当前用户ID| |loading|打开加载中的动画|加载中动画显示的文字|jsBridge.loading('加载中')|| |setFooterText|设置上拉底部加载中文字|底部加载中文字内容|jsBridge.setFooterText('上拉刷新')|| |callPhone|触发拨打电话|电话号码|jsBridge.callPhone('18888888888')|| |getPhotoUrls|查看大图|图片链接数组|jsBridge.getPhotoUrls(['http://a.jpg','http://b.jpg'])|| |shareArticle|分享文章|(文章所在群组Id,文章Id)|jsBridge.shareArticle(1,2)|| |getInputText|弹出键盘,获取键盘输入内容|回调函数|jsBridge.getInputText((data)=>{}))|回调函数返回值为键盘输入内容|