-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added test mode and window creation handler
- Loading branch information
1 parent
2d7da74
commit f074185
Showing
3 changed files
with
39 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const path = require('path'); | ||
const { BrowserWindow } = require('electron'); | ||
const config = require('../.erboilerplate/config'); | ||
|
||
const createAddWindow = (addWindow)=> { | ||
// create new window | ||
addWindow = new BrowserWindow({ | ||
width: 500, | ||
height: 500, | ||
title: 'Add Shopping List Item', | ||
webPreferences: { | ||
nodeIntegration: false, // is default value after Electron v5 | ||
contextIsolation: true, // protect against prototype pollution | ||
enableRemoteModule: false, // turn off remote | ||
preload: path.join(__dirname, "preload.js") // use a preload script | ||
}, | ||
}); | ||
// load the add the component file | ||
addWindow.loadURL( | ||
process.env.NODE_ENV !== 'production' | ||
? path.join(config.DEV_SERVER_URL,'add') | ||
: config.getProdServerURL('#/add') | ||
); | ||
|
||
addWindow.on('close', () => { | ||
addWindow = null; | ||
}); | ||
return addWindow; | ||
} | ||
|
||
module.exports = { | ||
createAddWindow | ||
} |