Skip to content

Commit b456557

Browse files
committed
docs(recipes/multipage): simplify app protocol creation
1 parent 0b8a97b commit b456557

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

docs/guide/recipes.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,13 @@ Follow [Vue CLI's instructions](https://cli.vuejs.org/config/#pages) for adding
170170

171171
### Create Variable for Second Page
172172

173-
Add the `secondWin` and `createdAppProtocol` variables to your background file (`src/background.(js|ts)` by default):
173+
Add the `secondWin` variable to your background file (`src/background.(js|ts)` by default):
174174

175175
```js
176176
// Already in file
177177
let win
178-
// Add these below
178+
// Add this below
179179
let secondWin
180-
let createdAppProtocol = false
181180
```
182181

183182
### Accept Page Arguments for `createWindow` Function
@@ -219,10 +218,6 @@ function createWindow(winVar, devPath, prodPath) {
219218
winVar.loadURL(process.env.WEBPACK_DEV_SERVER_URL + devPath)
220219
if (!process.env.IS_TEST) winVar.webContents.openDevTools()
221220
} else {
222-
if (!createdAppProtocol) {
223-
createProtocol('app')
224-
createdAppProtocol = true
225-
}
226221
// Load the index.html when not in development
227222
winVar.loadURL(`app://./${prodPath}`)
228223
}
@@ -250,6 +245,9 @@ app.on('ready', async () => {
250245
// Replace
251246
createWindow()
252247
// With
248+
if (!process.env.WEBPACK_DEV_SERVER_URL) {
249+
createProtocol('app')
250+
}
253251
createWindow(win, '', 'index.html')
254252
createWindow(secondWin, 'subpage', 'subpage.html')
255253
})

0 commit comments

Comments
 (0)