@jhh96/light-app-bridge 1.4.0 → 1.4.1
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 +8 -0
- package/package.json +1 -1
package/dist/lightAppBridge.js
CHANGED
|
@@ -104,6 +104,8 @@ function bindMessageBackend(cb) {
|
|
|
104
104
|
ev.off('native-call-js', handler);
|
|
105
105
|
else if (ev && typeof ev.removeListener === 'function')
|
|
106
106
|
ev.removeListener('native-call-js', handler);
|
|
107
|
+
else if (ev && typeof ev.remove === 'function')
|
|
108
|
+
ev.remove('native-call-js', handler); // waltz ≥1.1.7 API
|
|
107
109
|
});
|
|
108
110
|
}
|
|
109
111
|
// 2. 定义 handleMessageFromNative 路径:无 waltz 时。
|
|
@@ -152,6 +154,12 @@ function parseHandleMessageFromNative(raw) {
|
|
|
152
154
|
// handleMessageFromNative 入参带 responseId 包装
|
|
153
155
|
responseData = parsed && parsed.responseData != null ? parsed.responseData : parsed;
|
|
154
156
|
}
|
|
157
|
+
// waltz ≥1.1.7:event 总线(bl)派发载荷为 {id, data} 包装,responseData 在 .data 里
|
|
158
|
+
//(旧版 nativeCallWeb 直接派发裸 responseData)。裸数据有 .body 无 .data、包装有
|
|
159
|
+
// .data 无 .body,判据互斥,两种版本同一解析出口。
|
|
160
|
+
if (responseData && responseData.body == null && responseData.data != null) {
|
|
161
|
+
responseData = responseData.data;
|
|
162
|
+
}
|
|
155
163
|
if (!responseData || !responseData.body || responseData.body.eventName !== 'plugin-message') {
|
|
156
164
|
return null;
|
|
157
165
|
}
|