@jhh96/light-app-bridge 1.3.1 → 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 +5 -2
- 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 被忽略)
|