-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
53 lines (44 loc) · 1.4 KB
/
main.js
File metadata and controls
53 lines (44 loc) · 1.4 KB
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
const { app, BrowserWindow, systemPreferences, nativeTheme, ipcMain, Menu, shell } = require('electron');
const { autoUpdater } = require("electron-updater");
autoUpdater.checkForUpdatesAndNotify();
const path = require('path');
const isDev = require('electron-is-dev');
setInterval(()=>{
autoUpdater.checkForUpdatesAndNotify();
}, 15000);
function createWindow () {
// Create the browser window.
let win = new BrowserWindow({
'width': 1000,
'height': 650,
'minWidth': 400,
'minHeight': 650,
'title': "Condution",
'webPreferences': {
'nodeIntegration': true
},
'titleBarStyle': 'hiddenInset',
'transparent': true,
'show': false,
});
// TODO TODO TODO UNCOMMENT THIS!!
win.removeMenu();
// and load the main of the app.
if (isDev)
win.loadURL(`http://localhost:3000`);
else
win.loadURL(`file://${path.join(__dirname, './build/index.html')}`);
win.webContents.setWindowOpenHandler(({ url }) => {
// config.fileProtocol is my custom file protocol
if (url.startsWith("http") || url.startsWith("https")) {
shell.openExternal(url);
return { action: 'deny' };
}
return { action: 'allow' };
});
win.once('ready-to-show', function() {
win.show()
});
}
app.name = 'yasma';
app.whenReady().then(createWindow);