crh-jssdk 1.0.9 → 1.0.10
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.
|
@@ -13,14 +13,22 @@ exports.JYClientTHS = exports.jyBridge = exports.globalBridge = exports.Bridge =
|
|
|
13
13
|
* 文档参考: client-demo/sdk/ClientTemplate.js
|
|
14
14
|
*/
|
|
15
15
|
var JYClientTHS = {
|
|
16
|
+
// 标记bridge.init是否已调用,避免重复初始化
|
|
17
|
+
_bridgeInitCalled: false,
|
|
16
18
|
/**
|
|
17
19
|
* 初始化Bridge连接
|
|
18
20
|
* 与ClientTemplate.js保持一致
|
|
19
21
|
*/
|
|
20
22
|
init: function () {
|
|
23
|
+
var _this = this;
|
|
21
24
|
try {
|
|
22
25
|
this.connectWebViewJavascriptBridge(function (bridge) {
|
|
23
|
-
bridge.init(
|
|
26
|
+
// 只有在未初始化过的情况下才调用bridge.init()
|
|
27
|
+
if (!_this._bridgeInitCalled && bridge && typeof bridge.init === 'function') {
|
|
28
|
+
bridge.init(function () { });
|
|
29
|
+
_this._bridgeInitCalled = true;
|
|
30
|
+
console.log('JYClientTHS bridge.init() 已调用');
|
|
31
|
+
}
|
|
24
32
|
});
|
|
25
33
|
}
|
|
26
34
|
catch (e) {
|