简体   繁体   English

主机和远程之间的微前端通信

[英]Microfrontend communication between host and remote

I need to communicate between shell and remote in my microfrontend application (with module federation) Everything is ok using CustomEvent when the remote communicate to the shell, the problem is when the shell need to comunicate to the remote that could be not istantiated when the message is dispatched. I need to communicate between shell and remote in my microfrontend application (with module federation) Everything is ok using CustomEvent when the remote communicate to the shell, the problem is when the shell need to comunicate to the remote that could be not istantiated when the message被派遣。 How to detect that and begin the communication only when the remote comes up?只有当遥控器出现时,如何检测并开始通信?

sounds like some piece of state should be shareable between host and remote.听起来 state 的某些部分应该可以在主机和远程之间共享。 this way you could update the state from the shell, and then read the result from the remote at any point of time.这样,您可以从 shell 更新 state,然后随时从远程读取结果。

to make that work just use your favourite redux state management solution, their behavior is very simillar and should work whatever you choose,要使其工作,只需使用您最喜欢的 redux state 管理解决方案,它们的行为非常相似,无论您选择什么都应该工作,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM