主进程和渲染进程、渲染进程和渲染进程通讯。
主进程和渲染进程通讯。
- 使用 IPC 是很方便的
渲染进程和渲染进程通讯。
- 使用全局共享属性(globald对象和remote.getGlobal方法)。
1 | // In the main process. |
- 利用主进程做消息中转。
1 | // In the main process. |
- 利用 remote 接口直接获取渲染进程发送消息:
1 |
- ipcRenderer.sendTo接口。
1 | ipcRenderer.sendTo(windowId, 'ping', 'someThing') |