-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
53 lines (44 loc) · 1.25 KB
/
background.js
File metadata and controls
53 lines (44 loc) · 1.25 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
53
const {
app, BrowserWindow, Menu, shell,
} = require('electron')
let win
function createWindow() {
const path = require('path')
const winOption = {
width: 1200,
height: 800,
minHeight: 642,
minWidth: 1000,
webPreferences: {
webSecurity: false,
nodeIntegration: true,
contextIsolation: false,
preload: path.join(__dirname, 'src/preload-dev.js'),
enableRemoteModule: true,
},
titleBarStyle: 'hiddenInset',
}
win = new BrowserWindow(winOption)
win.setTitle('Gridea (dev)')
const url = process.env.WEBPACK_DEV_SERVER_URL || `file://${__dirname}/index.html`
win.loadURL(url)
win.on('closed', () => { win = null })
const template = []
const menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
}
app.on('ready', () => {
createWindow()
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit()
})
app.on('activate', () => { if (win === null) createWindow() })
// Allow parent process to ask for graceful exit in dev
if (process.env.NODE_ENV !== 'production') {
if (process.platform === 'win32') {
process.on('message', (data) => { if (data === 'graceful-exit') app.quit() })
} else {
process.on('SIGTERM', () => { app.quit() })
}
}