This commit is contained in:
vet
2026-04-14 12:18:15 +07:00
parent 4128760a07
commit fdb9679577
2 changed files with 53 additions and 0 deletions

View File

@@ -323,6 +323,8 @@ pc_check_wasm_assets() {
warn " PC SDK 资源不可达: ${url}SDK login 可能卡住且不会发起 /msg_gateway WebSocket"
fi
done
info " 浏览器侧 SDK 检查: typeof Go / typeof window.initSDK / typeof window.login / typeof window.commonEventFunc"
}
pc_ensure_wasm_assets() {

51
pc-sdk-probe.sh Executable file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/env bash
set -euo pipefail
cat <<'EOF'
在 Chrome DevTools Console 粘贴执行:
(() => {
const stamp = () => new Date().toISOString();
const wrap = (name) => {
const original = window[name];
if (typeof original !== "function" || original.__deployTestProbe) {
console.log(`[probe] ${name}:`, typeof original);
return;
}
const wrapped = function (...args) {
console.log(`[probe ${stamp()}] ${name} called`, args);
try {
const ret = original.apply(this, args);
console.log(`[probe ${stamp()}] ${name} returned`, ret);
return ret;
} catch (err) {
console.error(`[probe ${stamp()}] ${name} threw`, err);
throw err;
}
};
wrapped.__deployTestProbe = true;
window[name] = wrapped;
};
["initSDK", "login", "commonEventFunc"].forEach(wrap);
window.addEventListener("error", (event) => {
console.error("[probe window error]", event.message, event.filename, event.lineno, event.error);
});
window.addEventListener("unhandledrejection", (event) => {
console.error("[probe unhandledrejection]", event.reason);
});
console.log("[probe ready]", {
electronAPI: Boolean(window.electronAPI),
Go: typeof Go,
initSDK: typeof window.initSDK,
login: typeof window.login,
commonEventFunc: typeof window.commonEventFunc,
openIMRenderApi: typeof window.openIMRenderApi,
});
})();
然后退出登录/刷新页面重新登录一次,观察是否打印:
- initSDK called / returned
- login called / returned
- window error / unhandledrejection
EOF