mobile-web-bridge 0.1.1-beta.1 → 0.1.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Mobile Web Bridge contributors
3
+ Copyright (c) 2026 gaoxiao228
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -2,12 +2,14 @@
2
2
 
3
3
  MWB 为 iOS 和 Android 的 Web 容器提供统一 JS API。原生通信由 DSBridge 3.x 完成。
4
4
 
5
- 当前为未公开发布的 0.1 预览版。以下 npm 包名用于接入示意;当前可用的本地源码安装方式见根 README。
5
+ 当前源码版本为 `0.1.2`,与本轮 iOS/Android 源码配套;尚未发布 npm,下方安装命令仍指向已发布的 Beta。
6
+
7
+ 已公开发布 `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
8
 
7
9
  ## 安装和使用
8
10
 
9
11
  ```bash
10
- npm install mobile-web-bridge
12
+ npm install mobile-web-bridge@0.1.1-beta.1
11
13
  ```
12
14
 
13
15
  ```ts
@@ -33,50 +35,87 @@ await mwb.setNavigationBarTheme({
33
35
 
34
36
  网页也可直接引入发布包中的 `dist/mwb.iife.js`,通过 `window.mwb` 调用。应在 MWB 原生容器内加载;普通浏览器中的原生调用会给出“桥未就绪”错误。
35
37
 
36
- 完整的 H5 方法示例由相邻的 [`MWB-Demo-Web`](../MWB-Demo-Web/README.md) 维护,可构建为静态站点并同步到 iOS、Android 示例 App。
38
+ 完整的 H5 方法示例由 [`MWB-Demo-Web`](https://github.com/gaoxiao228/MobileWebBridge/tree/main/MWB-Demo-Web) 维护,可构建为静态站点并同步到 iOS、Android 示例 App。SDK 面向浏览器,不提供 SSR/Node 服务端或 CommonJS 入口;Nuxt 等环境只在客户端导入。
37
39
 
38
- ## 插件组合与构建
40
+ ## 首屏就绪通知
39
41
 
40
- 默认包提供 basic 的 48 个方法。源码分为 `container`、`device`、`media`、`storage` 四组;事件和 JS 句柄始终包含在 SDK 内。`basicPlugin` 为完整组合,`--plugins=basic` 可构建全量 basic;与旧分组混用时去重。原有 `createMWB(legacyPlugins)` 数组裁剪入口保留,只在 basic 下映射选中的方法。重复方法或覆盖 Core/事件入口的配置直接报错。
42
+ 当前源码新增 `await mwb.basic.notifyPageReady()`(也可用根入口 `mwb.notifyPageReady()`),用于 H5 主动通知当前原生容器首屏准备完成。无需注册业务插件,重复调用幂等。成功表示原生接受通知,不代表宿主已完成展示。
41
43
 
42
- ```bash
43
- pnpm install
44
- pnpm build
45
- pnpm build:composition --plugins=container,device
46
- npm pack --dry-run
47
- ```
44
+ 已发布的 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
45
 
49
- 组合脚本在 `dist` 输出 `mwb.container-device.iife.js`。组合产物只暴露选中的功能方法,适合按应用需求自行部署;npm 默认入口仍提供全量接口。`npm pack` 会通过 prepack 自动重新构建并检查入口、声明和许可,防止空包或旧产物。构建和打包命令不执行公开发布。
46
+ ## 同步与异步调用
50
47
 
51
- ## 指定版本发布 npm
48
+ 调用方式由 SDK 的方法声明和对应原生实现共同决定。`mwb.basic.xxx()` 与 `mwb.xxx()` 是同一实现;TypeScript 返回非 Promise 的方法直接使用,返回 Promise 的方法使用 `await` 或 `.then/.catch`。
52
49
 
53
- 在 `MWB-JS` 目录安装依赖后执行。版本必须是完整版本号,如 `0.1.1` 或 `0.2.0-beta.1`,不接受 `patch` 等隐式递增参数,也不接受 npm 发布时会移除的 `+build` 构建元数据。
50
+ ### basic 同步方法
54
51
 
55
- ```bash
56
- pnpm install --frozen-lockfile
52
+ basic 中有 9 个同步原生入口:
53
+
54
+ - 信息读取:`getAppInfoSync`、`getDeviceInfoSync`、`getClipboardDataSync`、`getNetworkTypeSync`。
55
+ - 本地存储:`setStorageSync`、`getStorageSync`、`removeStorageSync`、`clearStorageSync`。
56
+ - 调试设置:`setEnableDebug`,立即返回 `void`,名称没有 `Sync` 后缀。
57
+
58
+ 同步调用直接返回业务值或 `void`,不会返回 `{errCode, result}` 包装;失败会抛错。桥必须已在当前 MWB 容器中可用(相关错误为 `-1000`),`getAppInfoSync` 还要求宿主配置应用信息;同步不代表无需权限或平台支持。
57
59
 
58
- # 先预演:执行检查、构建、真实打包和 npm publish --dry-run,不公开发布。
59
- npm run release -- 0.2.0-beta.1 --dry-run
60
+ ```ts
61
+ import { mwb, MWBBridgeError } from "mobile-web-bridge";
62
+
63
+ // 同步读取少量本地数据;不存在的键返回 undefined。
64
+ try {
65
+ mwb.basic.setStorageSync("theme", "dark", "settings");
66
+ const theme = mwb.basic.getStorageSync<string>("theme", "settings");
67
+ console.log(theme);
68
+ } catch (error) {
69
+ if (error instanceof MWBBridgeError) console.error(error.errCode, error.errorMsg);
70
+ else console.error(error);
71
+ }
72
+ ```
60
73
 
61
- # 使用有该包发布权限的 npm 账号登录,按 npm 提示完成身份验证。
62
- npm login --registry=https://registry.npmjs.org/
74
+ 同步调用仍有跨桥、序列化和系统访问成本;避免在循环、滚动或动画回调中反复调用,也不要在同步原生路径中等待异步任务。`await mwb.getAppInfoSync()` 会先执行同步工作再等待其返回值,不会解除同步阻塞。
63
75
 
64
- # 发布预览版:默认使用 next 标签。
65
- npm run release -- 0.2.0-beta.1
76
+ ### basic 异步方法
66
77
 
67
- # 发布正式版:显式使用 latest 标签。
68
- npm run release -- 0.2.0 --tag latest
78
+ 既有 21 个 basic 异步原生入口(例如 `toast`、`navigateTo`、`chooseImage`、`scanCode`)返回 `Promise<GenericAsyncResult<T>>`。成功为 `{errCode: 0, result?: T}`;失败拒绝 Promise,不应只在 `.then` 中检查 errCode。
69
79
 
70
- # 也支持 beta 等自定义标签;查看参数说明。
71
- npm run release -- 0.2.0-beta.2 --tag beta
72
- npm run release -- --help
80
+ ```ts
81
+ import { mwb, MWBBridgeError } from "mobile-web-bridge";
82
+
83
+ // 在页面按钮等业务入口中调用;await 保证后续代码在本次响应之后执行。
84
+ async function copyMessage() {
85
+ try {
86
+ await mwb.basic.setClipboardData({ data: "Hello MWB" });
87
+ await mwb.basic.toast({ msg: "已复制" });
88
+ } catch (error) {
89
+ if (error instanceof MWBBridgeError) console.error(error.errCode, error.errorMsg);
90
+ else console.error(error);
91
+ }
92
+ }
73
93
  ```
74
94
 
75
- 脚本同步 `package.json` 和 `src/types.ts` 的版本,使发布包的版本与 `mwb.version` 一致;依次运行类型检查、完整 SDK 测试、带 prepack 保护的打包,再将同一个 tgz 以 public 权限发布到 `https://registry.npmjs.org/`。预发布版本不能使用 `latest`。先核实包名和账号权限,npm 不允许覆盖已发布的同名同版本。
95
+ Promise 完成仅表示该方法约定的操作完成:`navigateTo` 成功不等于新页面首屏完成,`toast` 成功不等于提示已消失。具体结果仍以各方法契约为准。
96
+
97
+ 除新增 `notifyPageReady()` 外,既有 basic 异步调用没有统一超时及文档失效兜底;原生未回调时可能持续等待。业务添加等待超时只会停止自己的等待,不代表原生操作已取消;支付等操作尤其不能据超时推断业务失败或直接重试。
98
+
99
+ ### 事件与自定义插件
100
+
101
+ 18 个 JS 句柄/事件方法不属于上述 30 个原生入口。`onAppShow`、`registerHandler` 等注册方法立即返回,回调后续触发;`await mwb.onAppShow(handler)` 不会等待应用进入前台。使用对应 `off` / `unRegister` 方法解绑;插件 `.on()` 返回解绑函数。
102
+
103
+ 通过 `defineNativePlugin` 声明的业务方法**只支持 `Promise<GenericAsyncResult<T>>`**。即便原生立即调用 `responder.success`,JS 仍应使用异步契约;不能声明普通对象返回值,也没有 `sync: true` 配置。`hasPlugin` 同样返回 Promise。
104
+
105
+ 自定义插件默认超时 30000ms,可配置 `timeoutMs` 为 1..120000 的整数;超时、文档失效和迟到结果按插件 Core 规则处理,这项保证不能套用到其他 basic 方法。取消能否终止实际业务取决于宿主服务;支付等不可撤销的操作还需独立查询最终状态。完整 Swift/Kotlin/H5 实现和同步读取替代方案见 [插件调用方式与线程约定](https://github.com/gaoxiao228/MobileWebBridge/blob/main/docs/native-plugins.md#调用方式与线程约定)。
106
+
107
+ ## 插件组合与构建
108
+
109
+ 当前源码默认提供 basic 的 49 个方法;已发布包为原有 48 个。源码分为 `container`、`device`、`media`、`storage` 四组;事件和 JS 句柄始终包含在 SDK 内。`basicPlugin` 为完整组合,`--plugins=basic` 可构建全量 basic;与旧分组混用时去重。原有 `createMWB(legacyPlugins)` 数组裁剪入口保留,只在 basic 下映射选中的方法。重复方法或覆盖 Core/事件入口的配置直接报错。
76
110
 
77
- `--dry-run` 完成或发布前检查失败、收到 Ctrl-C/SIGTERM 时,恢复两个源码版本文件;生成的 `dist` 属于忽略的构建产物,下次打包会重新构建。真实发布开始后保留目标版本,即使 npm 返回错误,也应先查询平台状态再决定是否重试,以免网络异常造成误判。可用 `npm view mobile-web-bridge@<版本号> version --registry=https://registry.npmjs.org/` 核实。
111
+ ```bash
112
+ pnpm install
113
+ pnpm build
114
+ pnpm build:composition --plugins=container,device
115
+ npm pack --dry-run
116
+ ```
78
117
 
79
- 脚本不自动安装依赖、登录、修改原生 SDK 版本、提交 Git、创建 Tag 或推送。发布成功后应检查版本差异,更新变更记录并提交;详细验收要求见 [发布说明](../docs/releasing.md)。
118
+ 组合脚本在 `dist` 输出 `mwb.container-device.iife.js`。组合产物只暴露选中的功能方法,适合按应用需求自行部署;npm 默认入口仍提供全量接口。`npm pack` 会通过 prepack 自动重新构建并检查入口、声明和许可,防止空包或旧产物。构建和打包命令不执行公开发布。
80
119
 
81
120
  ## 自定义原生插件
82
121
 
@@ -104,11 +143,11 @@ if (await sdk.hasPlugin("network")) {
104
143
  }
105
144
  ```
106
145
 
107
- 没有 `version` 或运行时 `methods` 数组。两阶段 builder 保留插件名字面量及方法/事件类型。新插件只支持异步 Promise;`hasPlugin` 查询原生注册且不创建实例,不代表所有方法都存在;首版不提供 hasMethod。默认 ESM/IIFE 仍只含 basic,使用业务插件时应构建自己的入口脚本。完整 Swift/Kotlin 接入、生命周期及浏览器构建见 [接入文档](../docs/native-plugins.md);可运行入口见 Demo 的 `src/plugins-sdk.ts`。
146
+ 没有 `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
147
 
109
148
  调用参数、成功结果和事件只接受 JSON:拒绝循环、函数、undefined 字段、非有限数字、非普通对象或 getter/setter。省略参数按 null 处理;显式结果 null 保留。超时默认 30000ms,允许整数 1..120000ms,超时以 `MWBBridgeError(-1103)` 拒绝。缺插件/方法分别为 `-1100/-1101`,旧壳无网关为 `-1106`,完整错误表见接入文档。
110
149
 
111
- 名称采用 `[a-z][a-zA-Z0-9_]*`。插件名不得占用 48 个根方法、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`。
150
+ 名称采用 `[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
151
 
113
152
  ## 接口约定
114
153
 
@@ -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 Mobile Web Bridge contributors
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-beta.1";
225
+ var version = "0.1.2";
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 Mobile Web Bridge contributors
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-beta.1";
227
+ var version = "0.1.2";
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
  },
@@ -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 {};
@@ -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-beta.1";
1
+ export declare const version = "0.1.2";
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-beta.1",
3
+ "version": "0.1.2",
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",