-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
40 lines (33 loc) · 1.09 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
const electron = require('electron')
const app = electron.app
const BrowserWindow = electron.BrowserWindow
// Live reload
// require('electron-reload')(__dirname)
let mainWindow
function createWindow () {
// create the browser window
mainWindow = new BrowserWindow({width: 1000, height: 800})
mainWindow.setMenu(null)
// render index.html which will contain our root Vue component
mainWindow.loadURL('file://' + __dirname + '/index.html')
// dereference the mainWindow object when the window is closed
mainWindow.on('closed', function () {
mainWindow = null
})
}
// call the createWindow() method when Electron has finished initializing
app.on('ready', createWindow)
// when all windows are closed, quit the application on Windows/Linux
app.on('window-all-closed', function () {
// only quit the application on OS X if the user hits cmd + q
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
// re-create the mainWindow if the dock icon is clicked in OS X and no other
// windows were open
if (mainWindow === null) {
createWindow()
}
})