crh-jssdk 1.0.25 → 1.0.27

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.
@@ -228,7 +228,7 @@ var JYBridge = /** @class */ (function () {
228
228
  * 等待Bridge准备就绪
229
229
  */
230
230
  JYBridge.prototype.waitForReady = function (timeout) {
231
- if (timeout === void 0) { timeout = 5000; }
231
+ if (timeout === void 0) { timeout = 300; }
232
232
  if (this.bridge) {
233
233
  return Promise.resolve();
234
234
  }
@@ -274,11 +274,11 @@ var Bridge = /** @class */ (function () {
274
274
  // 确保bridge.init存在且是函数,且未初始化过
275
275
  // 在iOS环境下,App原生可能已经调用过bridge.init(),再次调用会报错"init called twice"
276
276
  // 使用全局标记 window._WVJBInitialized 检测App原生的初始化
277
- if (bridge && typeof bridge.init === 'function') {
277
+ if (bridge && typeof (bridge === null || bridge === void 0 ? void 0 : bridge.init) === 'function') {
278
278
  // 双保险:在调用init前再次检查全局标记,避免并发或多次进入时重复调用
279
279
  if (!window._WVJBInitialized && !_this._bridgeInitCalled) {
280
280
  window._WVJBInitialized = true;
281
- bridge.init(function () {
281
+ bridge === null || bridge === void 0 ? void 0 : bridge.init(function () {
282
282
  console.log('Bridge初始化完成');
283
283
  _this._bridgeInitCalled = true;
284
284
  resolve();
@@ -383,7 +383,7 @@ var Bridge = /** @class */ (function () {
383
383
  }
384
384
  else {
385
385
  // Bridge未初始化,等待初始化完成
386
- _this.waitForReady(5000)
386
+ _this.waitForReady(300)
387
387
  .then(function () {
388
388
  if (_this.bridge) {
389
389
  useBridge_1(_this.bridge);
@@ -429,7 +429,7 @@ var Bridge = /** @class */ (function () {
429
429
  }
430
430
  else {
431
431
  // 等待初始化或直接连接
432
- this.waitForReady(3000)
432
+ this.waitForReady(300)
433
433
  .then(function () {
434
434
  if (_this.bridge) {
435
435
  useBridge_2(_this.bridge);
@@ -476,7 +476,7 @@ var Bridge = /** @class */ (function () {
476
476
  }
477
477
  else {
478
478
  // 等待初始化或直接连接
479
- this.waitForReady(3000)
479
+ this.waitForReady(300)
480
480
  .then(function () {
481
481
  if (_this.bridge) {
482
482
  useBridge_3(_this.bridge);
@@ -511,7 +511,7 @@ var Bridge = /** @class */ (function () {
511
511
  * @param timeout 超时时间(毫秒),默认5000ms
512
512
  */
513
513
  Bridge.prototype.waitForReady = function (timeout) {
514
- if (timeout === void 0) { timeout = 5000; }
514
+ if (timeout === void 0) { timeout = 300; }
515
515
  // 如果Bridge已经初始化,直接返回成功
516
516
  if (this.bridge) {
517
517
  return Promise.resolve();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crh-jssdk",
3
- "version": "1.0.25",
3
+ "version": "1.0.27",
4
4
  "description": "crh-jssdk",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {