Browse Source

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

Gregory R. Wroblewski 2 years ago
parent
commit
c16baa063a
1 changed files with 3 additions and 1 deletions
  1. 3 1
      docs/tutorial/tutorial-3-preload.md

+ 3 - 1
docs/tutorial/tutorial-3-preload.md

@@ -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