diff --git a/assets/debug/baishun_mock/index.html b/assets/debug/baishun_mock/index.html
index 4167b8d..5a53a5a 100644
--- a/assets/debug/baishun_mock/index.html
+++ b/assets/debug/baishun_mock/index.html
@@ -88,6 +88,8 @@
logEl.textContent = line + logEl.textContent;
}
+ let hasLoadedGame = false;
+
function requestConfig() {
if (!window.NativeBridge || typeof window.NativeBridge.getConfig !== "function") {
writeLog("getConfig", { error: "NativeBridge not ready" });
@@ -95,10 +97,14 @@
}
window.NativeBridge.getConfig(function (config) {
writeLog("getConfig callback", config);
+ if (!hasLoadedGame) {
+ setTimeout(notifyLoaded, 300);
+ }
});
}
function notifyLoaded() {
+ hasLoadedGame = true;
window.NativeBridge &&
window.NativeBridge.gameLoaded &&
window.NativeBridge.gameLoaded({ status: "loaded" });
@@ -126,6 +132,23 @@
window.addEventListener("walletUpdate", function (event) {
writeLog("walletUpdate event", event.detail || {});
});
+
+ window.addEventListener("baishunBridgeReady", function () {
+ writeLog("baishunBridgeReady", { status: "received" });
+ requestConfig();
+ });
+
+ window.addEventListener("baishunConfig", function (event) {
+ writeLog("baishunConfig event", event.detail || {});
+ });
+
+ window.addEventListener("load", function () {
+ setTimeout(function () {
+ if (!hasLoadedGame) {
+ requestConfig();
+ }
+ }, 150);
+ });