> For the complete documentation index, see [llms.txt](https://moluo.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://moluo.gitbook.io/notes/bian-cheng-xue-xi/electron/2.5.-jin-cheng-jian-tong-xun.md).

# 2.5.进程间通讯

## 进程之间的通讯方式

Electron使用IPC(interprocess communication)在进程之间进行通讯

## 安装Devtron插件

官网地址：[devtron](https://www.electronjs.org/devtron)

```bash
# Install Devtron
$ npm install --save-dev devtron

// Run the following from the Console tab of your app's DevTools
require('devtron').install()
// You should now see a Devtron tab added to the DevTools
```

```javascript
const { app, BrowserWindow} = require('electron')

app.on('ready',()=>{
  require('devtron').install()
  let mainWindow = new BrowserWindow({
    width: 1600,
    height: 1200,
    webPreferences: {
      nodeIntegration: true
    }
  })
  mainWindow.loadFile('index.html')
  mainWindow.webContents.openDevTools()
})
```
