docs: fix missing includes in code example (#35479)
This commit is contained in:
parent
87145c393c
commit
c16baa063a
1 changed files with 3 additions and 1 deletions
|
@ -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.
|
you send out the `invoke` call from the renderer.
|
||||||
|
|
||||||
```js {1,11} title="main.js"
|
```js {1,11} title="main.js"
|
||||||
const { ipcMain } = require('electron')
|
const { app, BrowserWindow, ipcMain } = require('electron')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
const createWindow = () => {
|
const createWindow = () => {
|
||||||
const win = new BrowserWindow({
|
const win = new BrowserWindow({
|
||||||
|
@ -198,6 +199,7 @@ const createWindow = () => {
|
||||||
ipcMain.handle('ping', () => 'pong')
|
ipcMain.handle('ping', () => 'pong')
|
||||||
win.loadFile('index.html')
|
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
|
Once you have the sender and receiver set up, you can now send messages from the renderer
|
||||||
|
|
Loading…
Reference in a new issue