From ac8a358e1ddba7a0226440e266b2b5438ec1c6ac Mon Sep 17 00:00:00 2001 From: Erick Zhao Date: Wed, 1 Sep 2021 15:00:15 -0700 Subject: [PATCH] docs: fix code example in process-model.md (#30690) * Update process-model.md the demo have two error: - at macos, close all window, the app will not quite, unless press cmd + q - attach preload.js, use preload prop that is member of `webPreferences` property of `BrowserWindow` controller argument * Update docs/tutorial/process-model.md Co-authored-by: Erick Zhao Co-authored-by: Cheng Zhao Co-authored-by: Erick Zhao --- docs/tutorial/process-model.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/tutorial/process-model.md b/docs/tutorial/process-model.md index 44ff022045c55..6b7737ec50b84 100644 --- a/docs/tutorial/process-model.md +++ b/docs/tutorial/process-model.md @@ -83,8 +83,8 @@ As a practical example, the app shown in the [quick start guide][quick-start-lif uses `app` APIs to create a more native application window experience. ```js title='main.js' -// quitting the app when no windows are open on macOS -app.on('window-all-closed', function () { +// quitting the app when no windows are open on non-macOS platforms +app.on('window-all-closed', () => { if (process.platform !== 'darwin') app.quit() }) ``` @@ -148,7 +148,9 @@ A preload script can be attached to the main process in the `BrowserWindow` cons const { BrowserWindow } = require('electron') //... const win = new BrowserWindow({ - preload: 'path/to/preload.js' + webPreferences: { + preload: 'path/to/preload.js' + } }) //... ```