@jhh96/light-app-bridge 1.3.0 → 1.3.2
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.
- package/dist/lightAppBridge.js +11 -4
- package/package.json +1 -1
package/dist/lightAppBridge.js
CHANGED
|
@@ -268,10 +268,13 @@ export default class LightAppBridge {
|
|
|
268
268
|
if (!this._debug)
|
|
269
269
|
return;
|
|
270
270
|
const w = window;
|
|
271
|
-
|
|
271
|
+
// 第二参兼容 number(超时毫秒)与 object(send 的 options 形态):
|
|
272
|
+
// 传 { timeout: 1500 } 时不再被当成数字拼进超时串(曾报"请求超时 ([object Object]ms)")
|
|
273
|
+
const sendFn = (data, opts) => {
|
|
272
274
|
// eslint-disable-next-line no-console
|
|
273
275
|
console.log(`[LightAppBridge:${this.role}] send→`, data);
|
|
274
|
-
|
|
276
|
+
const options = typeof opts === 'number' ? { timeout: opts } : opts;
|
|
277
|
+
return this.send(data, options);
|
|
275
278
|
};
|
|
276
279
|
const injectFn = (type, data, fromId, id) => {
|
|
277
280
|
const envelope = this._envelope(type, data != null ? data : {}, id || genId() // res 场景必须传原请求 id 才能配对唤醒(未传则生成新 id,作为陌生 res 被忽略)
|
|
@@ -334,8 +337,12 @@ export default class LightAppBridge {
|
|
|
334
337
|
this._log('recv← 忽略非本SDK消息: from=' + fromId);
|
|
335
338
|
return;
|
|
336
339
|
}
|
|
337
|
-
|
|
338
|
-
|
|
340
|
+
// ping/pong 是心跳噪音(默认 10s 一对),debug 日志跳过——生命周期关键
|
|
341
|
+
// 日志(pong 超时/恢复/兜底探测/失联)仍保留在 _pingOnce/_probeAlive 内
|
|
342
|
+
if (envelope.type !== 'ping' && envelope.type !== 'pong') {
|
|
343
|
+
this._log('recv← type=' + envelope.type + ' id=' + envelope.id +
|
|
344
|
+
' from=' + fromId + ' data=' + debugPayload(envelope.data));
|
|
345
|
+
}
|
|
339
346
|
switch (envelope.type) {
|
|
340
347
|
case 'hello':
|
|
341
348
|
this._onHello(fromId);
|