-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Labels
Description
Describe the bug
主应用通过这两种方式给微应用传递消息:
import { store as starkDataStore, event } from '@ice/stark-data';
event?.emit(MQTT_MESSAGE, { topic, message: JSON.parse(message.toString()) });
starkDataStore?.set(MQTT_MESSAGE, { topic, message: JSON.parse(message.toString()) });
在微应用中:
starkEvent.on(MQTT_MESSAGE, ({ topic, message }) => {
console.log('航班动态 收到主应用推送过来的消息', topic, message);
onReceivedMqttMessage({ topic, message });
});
starkEvent.off(MQTT_MESSAGE, () => {
console.log('航班动态 主应用推送过来的消息监听被移除');
});
starkEvent.off没起作用,反复执行starkEvent.on,主应用发送一次消息,会多次进入starkEvent.on的回调方法
Expected behavior
starkEvent.off(MQTT_MESSAGE, () => {
console.log('航班动态 主应用推送过来的消息监听被移除');
});
能够正常取消监听
Actual behavior
No response
Version of ice.js
"@ice/app": "3.4.10"
Content of build.json or ice.config.mts
No response
Additional context
No response