🚪 Entry Point Of Electron App
This commit is contained in:
parent
66a6709707
commit
58ab1f3f9f
17
main.js
17
main.js
@ -13,19 +13,28 @@ function isDev() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
|
// declare variables which hold file location to preload.js file and application's icon.
|
||||||
|
let preloadJS, appIcon;
|
||||||
|
|
||||||
|
if(isDev()) {
|
||||||
|
preloadJS = path.join(__dirname, 'preload.js');
|
||||||
|
appIcon = path.join(__dirname, 'public/favicon.png');
|
||||||
|
} else {
|
||||||
|
preloadJS = path.join(process.cwd(), 'resources/preload.js')
|
||||||
|
appIcon = path.join(__dirname, 'public/favicon.png');
|
||||||
|
}
|
||||||
|
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 600,
|
height: 600,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
|
preload: preloadJS,
|
||||||
// enableRemoteModule: true,
|
// enableRemoteModule: true,
|
||||||
// contextIsolation: false
|
// contextIsolation: false
|
||||||
},
|
},
|
||||||
// Use this in development mode.
|
icon: appIcon,
|
||||||
icon: isDev() ? path.join(process.cwd(), 'public/favicon.png') : path.join(__dirname, 'public/favicon.png'),
|
|
||||||
// Use this in production mode.
|
|
||||||
// icon: path.join(__dirname, 'public/favicon.png'),
|
|
||||||
show: false
|
show: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user