docs: fix missing includes in code example (#35479)

This commit is contained in:
Gregory R. Wroblewski 2022-09-07 15:37:29 +02:00 committed by GitHub
parent 87145c393c
commit c16baa063a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -185,7 +185,8 @@ loading the HTML file so that the handler is guaranteed to be ready before
you send out the `invoke` call from the renderer.
```js {1,11} title="main.js"
const { ipcMain } = require('electron')
const { app, BrowserWindow, ipcMain } = require('electron')
const path = require('path')
const createWindow = () => {
const win = new BrowserWindow({
@ -198,6 +199,7 @@ const createWindow = () => {
ipcMain.handle('ping', () => 'pong')
win.loadFile('index.html')
}
app.whenReady().then(createWindow)
```
Once you have the sender and receiver set up, you can now send messages from the renderer