ipcMain在电子中的广播消息 [英] Broadcasting message from ipcMain in electron

查看:85
本文介绍了ipcMain在电子中的广播消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将电子主要过程的消息广播到所有渲染器过程。 ipcMain 没有发送选项,只有一个选项可以答复通过 event.sender.send()发送。

I need to broadcast a message from main process of electron to all renderer processes. There is no send option for ipcMain, only an option to reply to the sender via event.sender.send().

推荐答案

寻找 webContents API。在帖子的同一页上:

You are looking for the webContents API. From the same page of documentation in your post:


也可以将消息从主进程发送到渲染器进程,请参见webContents发送更多信息。

It is also possible to send messages from the main process to the renderer process, see webContents.send for more information.

此处是 webContents

这篇关于ipcMain在电子中的广播消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆