Electron 主进程和渲染进程中的模块
remote模块
主要作用:提供了一种在渲染进程(网页)和主进程之间进行进程间通讯(IPC)的简便途径
例子:在渲染进程(index.html)中创建新的窗口
注意:
- Electron10.x 之前可以直接使用 remote 模块
- Electron10.x 以后 Electron14.x 以前要使用 remote 模块的话必须得在 BrowserWindow 中通过 enableRemoteModule: true 开启
- Electron14.x 以后官方把内置的 remote 挪到了第三方模块里面
例子:在渲染进程中创建新的窗口
1、安装 @electron/remote
npm install --sa