mobile-web-bridge 0.1.1-beta.1 → 0.1.1
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/LICENSE +1 -1
- package/README.md +69 -32
- package/dist/apiManifest.d.ts +1 -1
- package/dist/index.js +13 -2
- package/dist/mwb.iife.js +13 -2
- package/dist/nativePlugins.d.ts +2 -0
- package/dist/plugins/basic.d.ts +1 -0
- package/dist/plugins/container.d.ts +2 -0
- package/dist/types.d.ts +3 -1
- package/package.json +11 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
MWB 为 iOS 和 Android 的 Web 容器提供统一 JS API。原生通信由 DSBridge 3.x 完成。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
已公开发布 `0.1.1-beta.1`,当前仍处于 Beta 阶段。正式仓库:[gaoxiao228/MobileWebBridge](https://github.com/gaoxiao228/MobileWebBridge)。npm 的 `latest`/`next` 目前均为 Beta,建议固定精确版本;原生接入与支持范围见 [项目 README](https://github.com/gaoxiao228/MobileWebBridge#readme)。
|
|
6
6
|
|
|
7
7
|
## 安装和使用
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install mobile-web-bridge
|
|
10
|
+
npm install mobile-web-bridge@0.1.1-beta.1
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
```ts
|
|
@@ -33,50 +33,87 @@ await mwb.setNavigationBarTheme({
|
|
|
33
33
|
|
|
34
34
|
网页也可直接引入发布包中的 `dist/mwb.iife.js`,通过 `window.mwb` 调用。应在 MWB 原生容器内加载;普通浏览器中的原生调用会给出“桥未就绪”错误。
|
|
35
35
|
|
|
36
|
-
完整的 H5
|
|
36
|
+
完整的 H5 方法示例由 [`MWB-Demo-Web`](https://github.com/gaoxiao228/MobileWebBridge/tree/main/MWB-Demo-Web) 维护,可构建为静态站点并同步到 iOS、Android 示例 App。SDK 面向浏览器,不提供 SSR/Node 服务端或 CommonJS 入口;Nuxt 等环境只在客户端导入。
|
|
37
37
|
|
|
38
|
-
##
|
|
38
|
+
## 首屏就绪通知
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
当前源码新增 `await mwb.basic.notifyPageReady()`(也可用根入口 `mwb.notifyPageReady()`),用于 H5 主动通知当前原生容器首屏准备完成。无需注册业务插件,重复调用幂等。成功表示原生接受通知,不代表宿主已完成展示。
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
pnpm install
|
|
44
|
-
pnpm build
|
|
45
|
-
pnpm build:composition --plugins=container,device
|
|
46
|
-
npm pack --dry-run
|
|
47
|
-
```
|
|
42
|
+
已发布的 JS `0.1.1-beta.1` 不包含此能力,H5 须使用当前 JS 源码,并搭配 Android Maven `0.1.1` 或当前 iOS 源码;旧原生 `0.1.0` 不支持此能力。此方法走文档身份网关,等待上限 30000ms;旧原生和普通浏览器明确失败。调用时机、原生回调和重载规则见 [接入说明](https://github.com/gaoxiao228/MobileWebBridge/blob/main/docs/page-lifecycle.md)。
|
|
48
43
|
|
|
49
|
-
|
|
44
|
+
## 同步与异步调用
|
|
50
45
|
|
|
51
|
-
|
|
46
|
+
调用方式由 SDK 的方法声明和对应原生实现共同决定。`mwb.basic.xxx()` 与 `mwb.xxx()` 是同一实现;TypeScript 返回非 Promise 的方法直接使用,返回 Promise 的方法使用 `await` 或 `.then/.catch`。
|
|
52
47
|
|
|
53
|
-
|
|
48
|
+
### basic 同步方法
|
|
54
49
|
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
basic 中有 9 个同步原生入口:
|
|
51
|
+
|
|
52
|
+
- 信息读取:`getAppInfoSync`、`getDeviceInfoSync`、`getClipboardDataSync`、`getNetworkTypeSync`。
|
|
53
|
+
- 本地存储:`setStorageSync`、`getStorageSync`、`removeStorageSync`、`clearStorageSync`。
|
|
54
|
+
- 调试设置:`setEnableDebug`,立即返回 `void`,名称没有 `Sync` 后缀。
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
同步调用直接返回业务值或 `void`,不会返回 `{errCode, result}` 包装;失败会抛错。桥必须已在当前 MWB 容器中可用(相关错误为 `-1000`),`getAppInfoSync` 还要求宿主配置应用信息;同步不代表无需权限或平台支持。
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import { mwb, MWBBridgeError } from "mobile-web-bridge";
|
|
60
|
+
|
|
61
|
+
// 同步读取少量本地数据;不存在的键返回 undefined。
|
|
62
|
+
try {
|
|
63
|
+
mwb.basic.setStorageSync("theme", "dark", "settings");
|
|
64
|
+
const theme = mwb.basic.getStorageSync<string>("theme", "settings");
|
|
65
|
+
console.log(theme);
|
|
66
|
+
} catch (error) {
|
|
67
|
+
if (error instanceof MWBBridgeError) console.error(error.errCode, error.errorMsg);
|
|
68
|
+
else console.error(error);
|
|
69
|
+
}
|
|
70
|
+
```
|
|
60
71
|
|
|
61
|
-
|
|
62
|
-
npm login --registry=https://registry.npmjs.org/
|
|
72
|
+
同步调用仍有跨桥、序列化和系统访问成本;避免在循环、滚动或动画回调中反复调用,也不要在同步原生路径中等待异步任务。`await mwb.getAppInfoSync()` 会先执行同步工作再等待其返回值,不会解除同步阻塞。
|
|
63
73
|
|
|
64
|
-
|
|
65
|
-
npm run release -- 0.2.0-beta.1
|
|
74
|
+
### basic 异步方法
|
|
66
75
|
|
|
67
|
-
|
|
68
|
-
npm run release -- 0.2.0 --tag latest
|
|
76
|
+
既有 21 个 basic 异步原生入口(例如 `toast`、`navigateTo`、`chooseImage`、`scanCode`)返回 `Promise<GenericAsyncResult<T>>`。成功为 `{errCode: 0, result?: T}`;失败拒绝 Promise,不应只在 `.then` 中检查 errCode。
|
|
69
77
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
78
|
+
```ts
|
|
79
|
+
import { mwb, MWBBridgeError } from "mobile-web-bridge";
|
|
80
|
+
|
|
81
|
+
// 在页面按钮等业务入口中调用;await 保证后续代码在本次响应之后执行。
|
|
82
|
+
async function copyMessage() {
|
|
83
|
+
try {
|
|
84
|
+
await mwb.basic.setClipboardData({ data: "Hello MWB" });
|
|
85
|
+
await mwb.basic.toast({ msg: "已复制" });
|
|
86
|
+
} catch (error) {
|
|
87
|
+
if (error instanceof MWBBridgeError) console.error(error.errCode, error.errorMsg);
|
|
88
|
+
else console.error(error);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
73
91
|
```
|
|
74
92
|
|
|
75
|
-
|
|
93
|
+
Promise 完成仅表示该方法约定的操作完成:`navigateTo` 成功不等于新页面首屏完成,`toast` 成功不等于提示已消失。具体结果仍以各方法契约为准。
|
|
76
94
|
|
|
77
|
-
|
|
95
|
+
除新增 `notifyPageReady()` 外,既有 basic 异步调用没有统一超时及文档失效兜底;原生未回调时可能持续等待。业务添加等待超时只会停止自己的等待,不代表原生操作已取消;支付等操作尤其不能据超时推断业务失败或直接重试。
|
|
78
96
|
|
|
79
|
-
|
|
97
|
+
### 事件与自定义插件
|
|
98
|
+
|
|
99
|
+
18 个 JS 句柄/事件方法不属于上述 30 个原生入口。`onAppShow`、`registerHandler` 等注册方法立即返回,回调后续触发;`await mwb.onAppShow(handler)` 不会等待应用进入前台。使用对应 `off` / `unRegister` 方法解绑;插件 `.on()` 返回解绑函数。
|
|
100
|
+
|
|
101
|
+
通过 `defineNativePlugin` 声明的业务方法**只支持 `Promise<GenericAsyncResult<T>>`**。即便原生立即调用 `responder.success`,JS 仍应使用异步契约;不能声明普通对象返回值,也没有 `sync: true` 配置。`hasPlugin` 同样返回 Promise。
|
|
102
|
+
|
|
103
|
+
自定义插件默认超时 30000ms,可配置 `timeoutMs` 为 1..120000 的整数;超时、文档失效和迟到结果按插件 Core 规则处理,这项保证不能套用到其他 basic 方法。取消能否终止实际业务取决于宿主服务;支付等不可撤销的操作还需独立查询最终状态。完整 Swift/Kotlin/H5 实现和同步读取替代方案见 [插件调用方式与线程约定](https://github.com/gaoxiao228/MobileWebBridge/blob/main/docs/native-plugins.md#调用方式与线程约定)。
|
|
104
|
+
|
|
105
|
+
## 插件组合与构建
|
|
106
|
+
|
|
107
|
+
当前源码默认提供 basic 的 49 个方法;已发布包为原有 48 个。源码分为 `container`、`device`、`media`、`storage` 四组;事件和 JS 句柄始终包含在 SDK 内。`basicPlugin` 为完整组合,`--plugins=basic` 可构建全量 basic;与旧分组混用时去重。原有 `createMWB(legacyPlugins)` 数组裁剪入口保留,只在 basic 下映射选中的方法。重复方法或覆盖 Core/事件入口的配置直接报错。
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
pnpm install
|
|
111
|
+
pnpm build
|
|
112
|
+
pnpm build:composition --plugins=container,device
|
|
113
|
+
npm pack --dry-run
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
组合脚本在 `dist` 输出 `mwb.container-device.iife.js`。组合产物只暴露选中的功能方法,适合按应用需求自行部署;npm 默认入口仍提供全量接口。`npm pack` 会通过 prepack 自动重新构建并检查入口、声明和许可,防止空包或旧产物。构建和打包命令不执行公开发布。
|
|
80
117
|
|
|
81
118
|
## 自定义原生插件
|
|
82
119
|
|
|
@@ -104,11 +141,11 @@ if (await sdk.hasPlugin("network")) {
|
|
|
104
141
|
}
|
|
105
142
|
```
|
|
106
143
|
|
|
107
|
-
没有 `version` 或运行时 `methods` 数组。两阶段 builder 保留插件名字面量及方法/事件类型。新插件只支持异步 Promise;`hasPlugin` 查询原生注册且不创建实例,不代表所有方法都存在;首版不提供 hasMethod。默认 ESM/IIFE 仍只含 basic,使用业务插件时应构建自己的入口脚本。完整 Swift/Kotlin 接入、生命周期及浏览器构建见 [接入文档](
|
|
144
|
+
没有 `version` 或运行时 `methods` 数组。两阶段 builder 保留插件名字面量及方法/事件类型。新插件只支持异步 Promise;`hasPlugin` 查询原生注册且不创建实例,不代表所有方法都存在;首版不提供 hasMethod。默认 ESM/IIFE 仍只含 basic,使用业务插件时应构建自己的入口脚本。完整 Swift/Kotlin 接入、生命周期及浏览器构建见 [接入文档](https://github.com/gaoxiao228/MobileWebBridge/blob/main/docs/native-plugins.md);可运行入口见 Demo 的 `src/plugins-sdk.ts`。
|
|
108
145
|
|
|
109
146
|
调用参数、成功结果和事件只接受 JSON:拒绝循环、函数、undefined 字段、非有限数字、非普通对象或 getter/setter。省略参数按 null 处理;显式结果 null 保留。超时默认 30000ms,允许整数 1..120000ms,超时以 `MWBBridgeError(-1103)` 拒绝。缺插件/方法分别为 `-1100/-1101`,旧壳无网关为 `-1106`,完整错误表见接入文档。
|
|
110
147
|
|
|
111
|
-
名称采用 `[a-z][a-zA-Z0-9_]
|
|
148
|
+
名称采用 `[a-z][a-zA-Z0-9_]*`。插件名不得占用当前 49 个根方法、basic/version/hasPlugin、pluginSession/pluginInfo/invokePlugin/pluginEvent、dispatchEvent/backBtnPressed 或以下探测名。业务方法和事件禁止 `on/then/catch/finally/toJSON/inspect/constructor/prototype/__proto__`;`on` 专用于订阅。读取方法属性不发请求,Proxy 的 Promise/JSON/Symbol 探测不会调用原生。不要通过 `typeof sdk.network.someMethod` 判断原生是否支持该方法,原生才会根据标记方法返回 `-1101`。
|
|
112
149
|
|
|
113
150
|
## 接口约定
|
|
114
151
|
|
package/dist/apiManifest.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const apiMethods: readonly ["setEnableDebug", "openAppAuthorizeSetting", "toast", "getAppInfoSync", "setBadgeCount", "navigateTo", "navigateBack", "navigateBackToRoot", "openExternalBrowser", "setNavigationBarTheme", "getDeviceInfoSync", "getClipboardDataSync", "setClipboardData", "makePhoneCall", "getNetworkTypeSync", "getNotificationSwitchStatus", "cleanWebviewCache", "compressImage", "scanCode", "saveImageToPhotosAlbum", "chooseImage", "setStorageSync", "getStorageSync", "removeStorageSync", "clearStorageSync", "openFile", "exitApp", "checkRequestCameraPermissions", "convertImagePathToBase64", "openNativePage", "registerHandler", "unRegisterHandlers", "unRegisterHandler", "checkHandlerExist", "onNetworkStatusChange", "offNetworkStatusChange", "onAppShow", "offAppShow", "onAppHide", "offAppHide", "onRemoteNotificationReceive", "offRemoteNotificationReceive", "onPageShow", "offPageShow", "onPageHide", "offPageHide", "onBackBtnPressed", "offBackBtnPressed"];
|
|
1
|
+
export declare const apiMethods: readonly ["notifyPageReady", "setEnableDebug", "openAppAuthorizeSetting", "toast", "getAppInfoSync", "setBadgeCount", "navigateTo", "navigateBack", "navigateBackToRoot", "openExternalBrowser", "setNavigationBarTheme", "getDeviceInfoSync", "getClipboardDataSync", "setClipboardData", "makePhoneCall", "getNetworkTypeSync", "getNotificationSwitchStatus", "cleanWebviewCache", "compressImage", "scanCode", "saveImageToPhotosAlbum", "chooseImage", "setStorageSync", "getStorageSync", "removeStorageSync", "clearStorageSync", "openFile", "exitApp", "checkRequestCameraPermissions", "convertImagePathToBase64", "openNativePage", "registerHandler", "unRegisterHandlers", "unRegisterHandler", "checkHandlerExist", "onNetworkStatusChange", "offNetworkStatusChange", "onAppShow", "offAppShow", "onAppHide", "offAppHide", "onRemoteNotificationReceive", "offRemoteNotificationReceive", "onPageShow", "offPageShow", "onPageHide", "offPageHide", "onBackBtnPressed", "offBackBtnPressed"];
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
MIT License
|
|
3
3
|
|
|
4
|
-
Copyright (c) 2026
|
|
4
|
+
Copyright (c) 2026 gaoxiao228
|
|
5
5
|
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -222,7 +222,7 @@ var require_dsbridge = __commonJS({
|
|
|
222
222
|
var import_dsbridge = __toESM(require_dsbridge(), 1);
|
|
223
223
|
|
|
224
224
|
// src/types.ts
|
|
225
|
-
var version = "0.1.1
|
|
225
|
+
var version = "0.1.1";
|
|
226
226
|
|
|
227
227
|
// src/eventHub.ts
|
|
228
228
|
var hubs = /* @__PURE__ */ new WeakMap();
|
|
@@ -426,6 +426,7 @@ function assembleMWB(plugins) {
|
|
|
426
426
|
|
|
427
427
|
// src/apiManifest.ts
|
|
428
428
|
var apiMethods = [
|
|
429
|
+
"notifyPageReady",
|
|
429
430
|
"setEnableDebug",
|
|
430
431
|
"openAppAuthorizeSetting",
|
|
431
432
|
"toast",
|
|
@@ -637,6 +638,15 @@ async function hasNativePlugin(name) {
|
|
|
637
638
|
if (typeof value.result?.available !== "boolean") throw new MWBBridgeError(-1102, "Invalid plugin availability response");
|
|
638
639
|
return value.result.available;
|
|
639
640
|
}
|
|
641
|
+
function notifyPageReady() {
|
|
642
|
+
return invoke("mwb.invokePlugin", {
|
|
643
|
+
plugin: "basic",
|
|
644
|
+
method: "notifyPageReady",
|
|
645
|
+
params: null,
|
|
646
|
+
callId: `mwb-${Date.now()}-${++nextCall}`,
|
|
647
|
+
timeoutMs: 3e4
|
|
648
|
+
}, 3e4);
|
|
649
|
+
}
|
|
640
650
|
function createNamespace(descriptor) {
|
|
641
651
|
const functions = /* @__PURE__ */ new Map();
|
|
642
652
|
const on = (name, handler) => {
|
|
@@ -688,6 +698,7 @@ function attachNativePlugins(target, plugins) {
|
|
|
688
698
|
var containerPlugin = {
|
|
689
699
|
name: "container",
|
|
690
700
|
methods: {
|
|
701
|
+
notifyPageReady,
|
|
691
702
|
setEnableDebug(enabled) {
|
|
692
703
|
callSync("setEnableDebug", { enabled });
|
|
693
704
|
},
|
package/dist/mwb.iife.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
MIT License
|
|
3
3
|
|
|
4
|
-
Copyright (c) 2026
|
|
4
|
+
Copyright (c) 2026 gaoxiao228
|
|
5
5
|
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -224,7 +224,7 @@ SOFTWARE.
|
|
|
224
224
|
var import_dsbridge = __toESM(require_dsbridge(), 1);
|
|
225
225
|
|
|
226
226
|
// src/types.ts
|
|
227
|
-
var version = "0.1.1
|
|
227
|
+
var version = "0.1.1";
|
|
228
228
|
|
|
229
229
|
// src/eventHub.ts
|
|
230
230
|
var hubs = /* @__PURE__ */ new WeakMap();
|
|
@@ -428,6 +428,7 @@ SOFTWARE.
|
|
|
428
428
|
|
|
429
429
|
// src/apiManifest.ts
|
|
430
430
|
var apiMethods = [
|
|
431
|
+
"notifyPageReady",
|
|
431
432
|
"setEnableDebug",
|
|
432
433
|
"openAppAuthorizeSetting",
|
|
433
434
|
"toast",
|
|
@@ -631,6 +632,15 @@ SOFTWARE.
|
|
|
631
632
|
if (typeof value.result?.available !== "boolean") throw new MWBBridgeError(-1102, "Invalid plugin availability response");
|
|
632
633
|
return value.result.available;
|
|
633
634
|
}
|
|
635
|
+
function notifyPageReady() {
|
|
636
|
+
return invoke("mwb.invokePlugin", {
|
|
637
|
+
plugin: "basic",
|
|
638
|
+
method: "notifyPageReady",
|
|
639
|
+
params: null,
|
|
640
|
+
callId: `mwb-${Date.now()}-${++nextCall}`,
|
|
641
|
+
timeoutMs: 3e4
|
|
642
|
+
}, 3e4);
|
|
643
|
+
}
|
|
634
644
|
function createNamespace(descriptor) {
|
|
635
645
|
const functions = /* @__PURE__ */ new Map();
|
|
636
646
|
const on = (name, handler) => {
|
|
@@ -682,6 +692,7 @@ SOFTWARE.
|
|
|
682
692
|
var containerPlugin = {
|
|
683
693
|
name: "container",
|
|
684
694
|
methods: {
|
|
695
|
+
notifyPageReady,
|
|
685
696
|
setEnableDebug(enabled) {
|
|
686
697
|
callSync("setEnableDebug", { enabled });
|
|
687
698
|
},
|
package/dist/nativePlugins.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ export declare function defineNativePlugin<Methods extends AsyncMethods<Methods>
|
|
|
30
30
|
} & SafeMethods<Methods>) => MWBNativePlugin<Name, Methods, Events>;
|
|
31
31
|
/** 只查询原生注册,不把本地 JS 描述误报成已安装能力。 */
|
|
32
32
|
export declare function hasNativePlugin(name: string): Promise<boolean>;
|
|
33
|
+
/** 内置首屏通知复用插件身份与有界等待,不通过普通 basic 通道跨文档投递。 */
|
|
34
|
+
export declare function notifyPageReady(): Promise<GenericAsyncResult<void>>;
|
|
33
35
|
/** 在根对象只挂载插件命名空间,禁止覆盖 basic 或任何既有根方法。 */
|
|
34
36
|
export declare function attachNativePlugins(target: object, plugins: readonly MWBNativePlugin[]): void;
|
|
35
37
|
export {};
|
package/dist/plugins/basic.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare const basicPlugin: {
|
|
|
22
22
|
readonly makePhoneCall: (param: import("..").ParamPhoneCall) => Promise<import("..").GenericAsyncResult<undefined>>;
|
|
23
23
|
readonly getNetworkTypeSync: () => import("..").ReturnNetworkType;
|
|
24
24
|
readonly getNotificationSwitchStatus: () => Promise<import("..").GenericAsyncResult<import("..").ReturnNotiSwitchStatus>>;
|
|
25
|
+
readonly notifyPageReady: typeof import("../nativePlugins").notifyPageReady;
|
|
25
26
|
readonly setEnableDebug: (enabled: boolean) => void;
|
|
26
27
|
readonly toast: (param: import("..").ParamToast) => Promise<import("..").GenericAsyncResult<undefined>>;
|
|
27
28
|
readonly navigateTo: (param: import("..").ParamNavigateTo) => Promise<import("..").GenericAsyncResult<undefined>>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { notifyPageReady } from "../nativePlugins";
|
|
1
2
|
/** Web 容器和页面导航能力。 */
|
|
2
3
|
export declare const containerPlugin: {
|
|
3
4
|
readonly name: "container";
|
|
4
5
|
readonly methods: {
|
|
6
|
+
notifyPageReady: typeof notifyPageReady;
|
|
5
7
|
setEnableDebug(enabled: boolean): void;
|
|
6
8
|
toast(param: import("..").ParamToast): Promise<import("..").GenericAsyncResult<undefined>>;
|
|
7
9
|
navigateTo(param: import("..").ParamNavigateTo): Promise<import("..").GenericAsyncResult<undefined>>;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const version = "0.1.1
|
|
1
|
+
export declare const version = "0.1.1";
|
|
2
2
|
type TYPE_VERSION = typeof version;
|
|
3
3
|
export type GenericAsyncResult<T = any> = {
|
|
4
4
|
errCode: number;
|
|
@@ -340,6 +340,8 @@ export type ParamCheckRequestCameraPermissions = {
|
|
|
340
340
|
permissionPromptMessage?: string;
|
|
341
341
|
};
|
|
342
342
|
export interface MWBJSSDK {
|
|
343
|
+
/** 当前主文档首屏已准备好;重复调用幂等,不代表宿主展示动画已完成。 */
|
|
344
|
+
notifyPageReady(): Promise<GenericAsyncResult<void>>;
|
|
343
345
|
version: TYPE_VERSION;
|
|
344
346
|
setEnableDebug(enableDebug: boolean): void;
|
|
345
347
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobile-web-bridge",
|
|
3
|
-
"version": "0.1.1
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Mobile Web Bridge JavaScript SDK",
|
|
5
|
+
"author": "gaoxiao228",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/gaoxiao228/MobileWebBridge.git",
|
|
9
|
+
"directory": "MWB-JS"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/gaoxiao228/MobileWebBridge#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/gaoxiao228/MobileWebBridge/issues"
|
|
14
|
+
},
|
|
5
15
|
"type": "module",
|
|
6
16
|
"license": "MIT",
|
|
7
17
|
"main": "./dist/index.js",
|