This repository has been archived by the owner on Oct 25, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
main.js
61 lines (53 loc) · 1.55 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const { app, BrowserWindow } = require('electron');
const path = require('path');
require('./core');
const isDevelopment = process.argv
.slice(1)
.some((argument) => argument === '--serve');
function createWindow() {
const win = new BrowserWindow({
width: 1200,
height: 730,
minHeight: 680,
minWidth: 1200,
title: 'App Outlet',
webPreferences: {
nodeIntegration: true,
preload: path.join(__dirname, 'preload.js'),
},
});
if (isDevelopment) {
require('electron-reload')(__dirname, {
electron: path.join(__dirname, 'node_modules', '.bin', 'electron'),
});
win.loadURL('http://localhost:4200/#/')
.then(() => {
console.log('Content loaded on development environment');
})
.catch(() => {
console.error(
'Unable to load content on development environment',
);
});
} else {
win.loadFile(`${__dirname}/dist/app-outlet/index.html`)
.then(() => {
console.log('Content loaded');
})
.catch(() => {
console.error('Unable to load content');
});
win.setMenuBarVisibility(false);
}
}
app.whenReady().then(createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});