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

mql-webview-bridge

v1.1.3

Published

客户端通信集合

Downloads

6

Readme

koznak-webview-bridge

客户端通信集合

安装

npm i mql-webview-bridge -S

示例🌰

bridgeGetUserInfo 🔧

获取用户信息

代码演示

import { bridgeGetUserInfo } from "mql-webview-bridge";
const userInfo = await bridgeGetUserInfo();

返回类型

Promise<GetUserInfoR>

|字段|说明|类型| |:---:|:---:|:--:| |userId|唯一标识|string |tocken|登陆令牌|string |version|版本号|string |deviceId|设备ID|string |carrier|运营商|"Mobile" | "Unicom" | "Telecom" |""

类型定义

import type { GetUserInfoR } from "mql-webview-bridge";

bridgeHandleShare 🔧

唤起客户端分享弹窗

代码演示

import { bridgeHandleShare } from "mql-webview-bridge";
const res = await bridgeHandleShare({ shareString: "", shareTitle: "", shareUrl: "" })

参数说明

HandleShareP

|字段|说明|类型| |:---:|:---:|:--:| | shareString |描述|string | shareTitle |标题|string | shareUrl |分享页地址|string

返回类型

Promise<boolean>

是否分享成功

类型定义

import type { HandleShareP } from "mql-webview-bridge";

bridgeGetOpenId 🔧

获取微信openId

代码演示

import { bridgeGetOpenId } from "mql-webview-bridge";
const openId = await bridgeGetOpenId()

返回类型

Promise<GetOpenId>

|字段|说明|类型| |:---:|:---:|:--:| | openid |微信openId|string

类型定义

import type { GetOpenId } from "mql-webview-bridge";

bridgeHandleBack 🔧

后退或销毁当前webview

代码演示

import { bridgeHandleBack } from "mql-webview-bridge";
bridgeHandleBack("back");

参数说明

HandleBackP

'back' | 'hide'

类型定义

import type { HandleBackP } from "mql-webview-bridge";

bridgeHandleLogin 🔧

唤起客户端登陆弹窗

代码演示

import { bridgeHandleLogin } from "mql-webview-bridge";
bridgeHandleLogin()

bridgeHandleUpDateUserInfo 🔧

客户端更新用户信息

代码演示

import { bridgeHandleUpDateUserInfo } from "mql-webview-bridge";
bridgeHandleUpDateUserInfo()

bridgeHandleStartLoading 🔧

唤起客户端加载动画

代码演示

import { bridgeHandleStartLoading } from "mql-webview-bridge";
bridgeHandleStartLoading()

bridgeHandleStopLoading 🔧

关闭客户端加载动画

代码演示

import { bridgeHandleStopLoading } from "mql-webview-bridge";
bridgeHandleStopLoading()

开发说明

目录结构

src

开发目录

|文件名|说明| |:---:|:---:| | bridge.ts |初始化webviewbridge全局变量 | callAppFunc.ts |发布订阅通信方法 | funcs.ts |可订阅事件集合 | interface.ts |调用方法集合 | type.ts |类型集合 |index.ts|入口文件

tests

测试目录

|文件名|说明| |:---:|:---:| | mock | 模拟客户端发布事件 | unit |测试用例

.husky

Git钩子相关

dist

打包文件

脚本说明

  • lint

ESlint代码语法校验、prettier代码格式校验并尝试自动修复

  • tsc

TypeScript类型校验

  • lint:commit

lint校验Git暂存区

  • patch

npm包版本升级

  • test

运行jest测试用例

  • build

打包

  • commit

git cz代码提交(用于commit信息约束)

  • 其他

CI、publish脚本用于CI发版、prepare用户Git钩子初始化