@kbapp/js-bridge 1.0.14-alpha.0 → 1.0.16-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md DELETED
@@ -1,108 +0,0 @@
1
- # 开吧客户端桥接
2
-
3
- > ⚠️ 重要提示:本 SDK 基于 TypeScript 开发,所有 API 参数均带有明确的必填 / 选填类型标注。使用时请务必开启 TS 类型检查或在 IDE 中查看参数提示,必填项缺失会直接提示错误,选填项可按需传入,请勿忽略类型提示以避免使用异常。
4
-
5
- ## 下载
6
-
7
- npm:
8
-
9
- ```js
10
- npm i @kbapp/js-bridge
11
- ```
12
-
13
- ### 或通过 script 标签引入
14
-
15
- 使用 unpkg CDN:
16
-
17
- ```html
18
- <script src="https://unpkg.com/@kbapp/js-bridge@latest/dist/umd/index.js"></script>
19
- ```
20
-
21
- 使用 jsdelivr CDN:
22
-
23
- ```html
24
- <script src="https://cdn.jsdelivr.net/npm/@kbapp/js-bridge@latest/dist/umd/index.js"></script>
25
- ```
26
-
27
- > 通过 script 标签引入后,SDK 将作为全局变量 `kbBridge` 挂载在 window 对象上
28
-
29
- ## 测试页面
30
-
31
- [https://unpkg.com/@kbapp/js-bridge@latest/examples/index.html](https://unpkg.com/@kbapp/js-bridge@latest/examples/index.html)
32
-
33
- ## 示例
34
-
35
- ```js
36
- import { saveImageToLocal } from '@kbapp/js-bridge'
37
-
38
- function saveImageHandle() {
39
- saveImageToLocal({
40
- imageUrl: 'https://static.kaiba315.com.cn/kaiba-logo.png',
41
- success() {
42
- console.log('执行成功')
43
- },
44
- })
45
- }
46
- ```
47
-
48
- ### 通过 script 标签引入的使用示例
49
-
50
- ```html
51
- <script src="https://unpkg.com/@kbapp/js-bridge@latest/dist/umd/index.js"></script>
52
- <script>
53
- async function saveImageHandle() {
54
- // 通过全局变量kbBridge访问SDK功能
55
- kbBridge.saveImageToLocal({
56
- imageUrl: 'https://static.kaiba315.com.cn/kaiba-logo.png',
57
- success() {
58
- console.log('保存成功')
59
- },
60
- fail(error) {
61
- console.log('保存失败', error)
62
- },
63
- })
64
- }
65
- </script>
66
- ```
67
-
68
- ## API
69
-
70
- ### 总览
71
-
72
- | 桥接 type | 方法 | 说明 | 链接 |
73
- | --------- | ---- | ---- | ---- |
74
- | - | `defineBridgeCallback` | 定义桥接调用的回调函数 | [查看文档](docs/api/define-bridge-callback.md) |
75
- | - | `runBridgeApi` | 执行桥接(无返回值) | [查看文档](docs/api/run-bridge-api.md) |
76
- | - | `runBridgeApiResponse` | 执行桥接(等待响应) | [查看文档](docs/api/run-bridge-api-response.md) |
77
- | - | `isAppVersionSupport` | 判断当前版本号是否支持 | [查看文档](docs/api/is-app-version-support.md) |
78
- | -1 | `closeWebView` | 关闭当前 webview | [查看文档](docs/api/close-web-view.md) |
79
- | - | `definePermissionUsage` | 定义隐私权限协议文案 | [查看文档](docs/api/define-permission-usage.md) |
80
- | - | `onAppSharePanelShow` | 监听分享面板打开事件 | [查看文档](docs/api/on-app-share-panel-show.md) |
81
- | 12 | `defineAppShareModel` | 定义页面分享内容 | [查看文档](docs/api/define-app-share-model.md) |
82
- | 58 | `openAppSharePanel` | 主动唤起分享面板 | [查看文档](docs/api/open-app-share-panel.md) |
83
- | 68 | `defineAppSharePanelState` | 定义分享面板控件布局 | [查看文档](docs/api/define-app-share-panel-state.md) |
84
- | 13 | `openPostEditor` | 唤起发帖器 | [查看文档](docs/api/open-post-editor.md) |
85
- | 26 | `scanQRCode` | 扫描二维码 | [查看文档](docs/api/scan-qrcode.md) |
86
- | 35 | `getAppBaseInfo` | 获取设备信息 | [查看文档](docs/api/get-app-base-info.md) |
87
- | 51 | `generateKBSign` | 生成 kbsign | [查看文档](docs/api/generate-kbsign.md) |
88
- | 56 | `checkForNewVersion` | 检测是否有新版本 | [查看文档](docs/api/check-for-new-version.md) |
89
- | 58 | `shareImage` | 分享海报 | [查看文档](docs/api/share-image.md) |
90
- | 64 | `setWebViewTitle` | 设置网页标题 | [查看文档](docs/api/set-web-view-title.md) |
91
- | 62 | `saveImageToLocal` | 保存图片到本地 | [查看文档](docs/api/save-image-to-local.md) |
92
- | 63 | `saveVideoToLocal` | 保存视频到本地 | [查看文档](docs/api/save-video-to-local.md) |
93
- | 69 | `reportDAEvent` | 上报数据埋点 | [查看文档](docs/api/report-daevent.md) |
94
- | - | `onLoopCheckAppLogin` | 启动轮询检查 APP 登录状态 | [查看文档](docs/api/on-loop-check-app-login.md) |
95
- | 31 | `getAppLoginInfo` | 获取 app 登录信息 | [查看文档](docs/api/get-app-login-info.md) |
96
- | 31 | `triggerAppLogin` | 触发 app 登录 | [查看文档](docs/api/trigger-app-login.md) |
97
- | 71 | `setScreenOrientation` | 设置屏幕方向 | [查看文档](docs/api/set-screen-orientation.md) |
98
- | 72 | `getAppSubscribeNotifyStatus` | 获取APP订阅通知状态 | [查看文档](docs/api/get-app-subscribe-notify-status.md) |
99
- | 73 | `openAppSubscribeNotifySettings` | 前往/打开 app订阅管理页面 | [查看文档](docs/api/open-app-subscribe-notify-settings.md) |
100
- | 1001 | `runAction` | 执行 action | [查看文档](docs/api/run-action.md) |
101
-
102
- | 类/枚举 | 说明 |
103
- | --------------- | --------------------- |
104
- | `BridgeCode` | kbapp 桥接状态码 |
105
- | `IS_KB_APP_ENV` | 是否在开吧 APP 环境中 |
106
- | `AppLoginInfo` | 登录信息模型 |
107
- | `AppShareModel` | 应用分享模型 |
108
- | `AppBaseInfo` | 设备信息模型 |