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

cnpc-emm-sdk

v1.2.8

Published

HSE综合管理 - app和web应用交互

Downloads

1

Readme

cnpc-emm-sdk - WebViewJavascriptBridge 完成app与h5应用的交互桥接

安装

npm install cnpc-emm-sdk

Usage

引入


import { HSEApp } from "cnpc-emm-sdk";

示例

1、登录 / 登出


// 登录
HSEApp.login({
	success(res) {
		// 前期约定res直接返回token字符串
		console.log("登录成功")
	},
	error(msg) {
		console.log("登录失败")
	}
})

//登出
HSEApp.logout({
	token: ""
})

2、唤起原生分享


// 调用app开放的share方法, 唤起原生登录弹窗
HSEApp.share({
	title: "分享标题",
	desc: "这一是一个描述描述描述描述描述描述描述描述描述描述描述描述",
	url: "http://www.baidu.com",
	base64Img: "",
	isCopyLink: 1,
	success(res) {
		console.log("点击了分享")
	},
	error(msg) {
		console.log("分享取消")
	}
})

3、获取当前定位


// 获取当前定位
HSEApp.location({
	success(res) {
		// 定位成功,返回的信息大致如下
		// let obj = {
		// 	longitude: 0,//经度
		// 	latitude: 0,//纬度
		// 	province: "",//省份
		// 	city: "",//城市
		// 	address:"",//详细地址
		// }
		console.log("定位成功")
	},
	error(msg) {
		console.log("定位失败")
	}
})

4、退出小程序


// 调用app开放的exit方法,app内部执行退出小程序操作
HSEApp.exit()

5、拨打电话


// 调用app开放的call方法,拨打电话
HSEApp.call({
	phone: "182xxxx0000"
})

6、上报日志


// 调用app开放的log方法,上报日志
HSEApp.log({
	msg: "日志内容"
})

7、路由监听,用于页面跳转


// 路由监听,应用启动时做个全局监听即可
HSEApp.routerListener(function(res) {
	//约定各页面跳转的路径缩写,如'/index'、'/mine'等
	console.log(res.path)
	//参数
	console.log(res.params)
})

8、打开其它小程序


/**
 * miniId:小程序id
 * param:参数,类似get参数拼接形式,如type=1&page=10
 */
HSEApp.openMini({
	miniId: "7788",
	param: "type=1&page=10",
	success(res) {
		console.log("打开成功")
	},
	error(msg) {
		console.log("打开失败")
	}
})