crh-jssdk 1.0.13 → 1.0.14
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.
|
@@ -146,6 +146,10 @@ exports.default = {
|
|
|
146
146
|
if (isWt) {
|
|
147
147
|
gotoUrl = url;
|
|
148
148
|
}
|
|
149
|
+
if (utils_1.ios) {
|
|
150
|
+
window.location.href = gotoUrl;
|
|
151
|
+
return [2 /*return*/];
|
|
152
|
+
}
|
|
149
153
|
console.log("goWebview入参", params);
|
|
150
154
|
console.log("金圆统一调用gotoNextPage,参数:", gotoUrl);
|
|
151
155
|
return [4 /*yield*/, utils_1.jyBridge.bridgeCallHandler("Promise", "gotoNextPage", {
|
|
@@ -7,6 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.JYClientTHS = exports.jyBridge = exports.globalBridge = exports.Bridge = exports.JYBridge = void 0;
|
|
10
|
+
// 在脚本加载时立即初始化 WVJBCallbacks 数组
|
|
11
|
+
// 确保 native WebViewJavascriptBridge 在注入完成并调用 _callWVJBCallbacks 时,WVJBCallbacks 始终存在
|
|
12
|
+
// 避免 "TypeError: undefined is not an object (evaluating 'callbacks.length')" 错误
|
|
13
|
+
if (typeof window !== 'undefined') {
|
|
14
|
+
window.WVJBCallbacks = window.WVJBCallbacks || [];
|
|
15
|
+
}
|
|
10
16
|
/**
|
|
11
17
|
* ClientTHS全局桥接对象
|
|
12
18
|
* 实现同花顺客户端提供的ClientTHS SDK方式
|
|
@@ -37,7 +43,8 @@ var JYClientTHS = {
|
|
|
37
43
|
},
|
|
38
44
|
/**
|
|
39
45
|
* 连接WebViewJavascriptBridge
|
|
40
|
-
*
|
|
46
|
+
* 仅依赖 WebViewJavascriptBridgeReady 事件,不使用 iframe 注入方式
|
|
47
|
+
* 原因:WVJBCallbacks 已在脚本顶层立即初始化,确保 native _callWVJBCallbacks 调用时数组始终存在
|
|
41
48
|
*/
|
|
42
49
|
connectWebViewJavascriptBridge: function (callback) {
|
|
43
50
|
// 如果Bridge已存在,直接使用
|
|
@@ -45,27 +52,18 @@ var JYClientTHS = {
|
|
|
45
52
|
callback(window.WebViewJavascriptBridge);
|
|
46
53
|
return;
|
|
47
54
|
}
|
|
48
|
-
// iOS设备:监听BridgeReady
|
|
49
|
-
// 与ClientTemplate.js保持一致的实现
|
|
55
|
+
// iOS设备:监听BridgeReady事件,不再使用iframe触发
|
|
50
56
|
if (!/Android/.test(navigator.userAgent)) {
|
|
51
57
|
// 监听BridgeReady事件
|
|
52
58
|
document.addEventListener('WebViewJavascriptBridgeReady', function () {
|
|
53
59
|
callback(window.WebViewJavascriptBridge);
|
|
54
60
|
}, false);
|
|
55
|
-
//
|
|
61
|
+
// WVJBCallbacks 已在脚本顶层初始化,此处直接 push 即可
|
|
56
62
|
if (window.WVJBCallbacks) {
|
|
57
63
|
window.WVJBCallbacks.push(callback);
|
|
58
64
|
}
|
|
59
65
|
else {
|
|
60
|
-
// 创建回调队列并通过iframe触发Bridge加载
|
|
61
66
|
window.WVJBCallbacks = [callback];
|
|
62
|
-
var iframe_1 = document.createElement('iframe');
|
|
63
|
-
iframe_1.style.display = 'none';
|
|
64
|
-
iframe_1.src = 'wvjbscheme://__BRIDGE_LOADED__';
|
|
65
|
-
document.documentElement.appendChild(iframe_1);
|
|
66
|
-
setTimeout(function () {
|
|
67
|
-
document.documentElement.removeChild(iframe_1);
|
|
68
|
-
}, 0);
|
|
69
67
|
}
|
|
70
68
|
}
|
|
71
69
|
},
|