问题描述
对于Electron应用程序,我想知道,是否可以代替使用远程模块在不同的Renderer进程之间进行通信,而要使用Observables。
For an Electron app, I was wondering, if we could instead of using the remote module to communicate between different Renderer Processes, use Observables.
我已经读过渲染器过程和Main过程完全不同,按照我的理解,这将限制Observable的使用。
I have read that Renderer Processes and the Main process are completely different which would, the way I understand, restrict the usage of Observables.
我也不完全了解Observable的详细信息。所以,请对我好一点:P
I am also not completely aware of the details of an Observable. So please, go easy on me :P
推荐答案
每个评论,我认为Observable与vs可能存在一些误读。不行Observable允许您以特定方式处理各种异步时间序列事件。 Electron的远程模块完全不同,它旨在在Electron的进程之间公开一些代理对象。
Per comment, I think there are some misreadings what Observable can do vs. can't do. Observable allows you to handle various asynchronous time-series event in a specific manner. Electron's remote module is entirely different, it aims to expose some of proxy object between processes in Electron.
要通过可观察的方式处理IPC消息,您可以根据需要轻松创建事件绑定,如 fromEvent(IPCxxx,'channel')//
,但它并没有摆脱IPC本身的必要性,因为在Electron的进程之间使用任何类型的ipc机制都是至关重要的-只需选择哪种机制即可。
For handling IPC's messages via observable, you could easily create event bindngs like fromEvent(IPCxxx, 'channel') //chain operator as you need
but it doesn't gets rid of necessary of IPC itself, as it is essential to use any kind of ipc mechanism between processes in Electron - just matter of which mechanism you'll choose for.
这篇关于RxJS Observables可以在Electron应用程序中执行进程间通信吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!