@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.
@@ -268,10 +268,13 @@ export default class LightAppBridge {
268
268
  if (!this._debug)
269
269
  return;
270
270
  const w = window;
271
- const sendFn = (data, timeout) => {
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
- return this.send(data, timeout != null ? { timeout } : undefined);
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 被忽略)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jhh96/light-app-bridge",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "type": "module",
5
5
  "description": "招商随行(WorkLink)插件窗口(plugin)与轻应用窗口(lightapp)之间的双向通信 SDK",
6
6
  "main": "./dist/index.js",