@webview-bridge/web 1.4.3 → 1.4.5
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/dist/commonjs/index.cjs
CHANGED
|
@@ -199,6 +199,15 @@ var linkBridgeStore = (initialState = {}) => {
|
|
|
199
199
|
emitter.on("bridgeStateChange", (data) => {
|
|
200
200
|
setState(data);
|
|
201
201
|
});
|
|
202
|
+
document.addEventListener("visibilitychange", () => {
|
|
203
|
+
if (document.visibilityState === "visible") {
|
|
204
|
+
window.ReactNativeWebView?.postMessage(
|
|
205
|
+
JSON.stringify({
|
|
206
|
+
type: "getBridgeState"
|
|
207
|
+
})
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
202
211
|
window.ReactNativeWebView?.postMessage(
|
|
203
212
|
JSON.stringify({
|
|
204
213
|
type: "getBridgeState"
|
|
@@ -407,6 +416,16 @@ var registerWebMethod = (bridge) => {
|
|
|
407
416
|
window.addEventListener("DOMContentLoaded", register);
|
|
408
417
|
return bridge;
|
|
409
418
|
}
|
|
419
|
+
document.addEventListener("visibilitychange", () => {
|
|
420
|
+
if (document.visibilityState === "visible") {
|
|
421
|
+
window.ReactNativeWebView?.postMessage(
|
|
422
|
+
JSON.stringify({
|
|
423
|
+
type: "registerWebMethod",
|
|
424
|
+
body: { bridgeNames }
|
|
425
|
+
})
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
});
|
|
410
429
|
register();
|
|
411
430
|
return bridge;
|
|
412
431
|
};
|
package/dist/module/index.mjs
CHANGED
|
@@ -169,6 +169,15 @@ var linkBridgeStore = (initialState = {}) => {
|
|
|
169
169
|
emitter.on("bridgeStateChange", (data) => {
|
|
170
170
|
setState(data);
|
|
171
171
|
});
|
|
172
|
+
document.addEventListener("visibilitychange", () => {
|
|
173
|
+
if (document.visibilityState === "visible") {
|
|
174
|
+
window.ReactNativeWebView?.postMessage(
|
|
175
|
+
JSON.stringify({
|
|
176
|
+
type: "getBridgeState"
|
|
177
|
+
})
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
172
181
|
window.ReactNativeWebView?.postMessage(
|
|
173
182
|
JSON.stringify({
|
|
174
183
|
type: "getBridgeState"
|
|
@@ -377,6 +386,16 @@ var registerWebMethod = (bridge) => {
|
|
|
377
386
|
window.addEventListener("DOMContentLoaded", register);
|
|
378
387
|
return bridge;
|
|
379
388
|
}
|
|
389
|
+
document.addEventListener("visibilitychange", () => {
|
|
390
|
+
if (document.visibilityState === "visible") {
|
|
391
|
+
window.ReactNativeWebView?.postMessage(
|
|
392
|
+
JSON.stringify({
|
|
393
|
+
type: "registerWebMethod",
|
|
394
|
+
body: { bridgeNames }
|
|
395
|
+
})
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
});
|
|
380
399
|
register();
|
|
381
400
|
return bridge;
|
|
382
401
|
};
|