-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
57 lines (42 loc) · 1.27 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
const { app, BrowserWindow } = require('electron')
const { initialize: initializeRemote, enable: enableRemote } = require('@electron/remote/main')
const path = require('path')
initializeRemote()
function createWindow() {
const mainWindow = new BrowserWindow({
frame: false,
width: 768,
minWidth: 768,
maxWidth: 768,
height: 530,
minHeight: 530,
maxHeight: 530,
backgroundColor: '#161616',
// show: false, // Для отображения только после загрузки
resizable: false,
webPreferences: {
// sandbox: true, // breaks @electron/remote import
devTools: false,
preload: path.join(__dirname, 'preload.js'),
enableRemoteModule: true,
contextIsolation: true
},
icon: path.join(__dirname, '/icons/icon.png')
})
mainWindow.loadFile('index.html')
// Отображение окна только после загрузки
// mainWindow.once('ready-to-show', () => {
// mainWindow.show()
// })
// mainWindow.webContents.openDevTools()
enableRemote(mainWindow.webContents)
}
app.whenReady().then(() => {
createWindow()
app.on('activate', function () {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})