-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
41 lines (32 loc) · 988 Bytes
/
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
const electron = require('electron')
const app = electron.app
const BrowserWindow = electron.BrowserWindow
const server = require('./src/server/server')
let mainWindow
function createWindow() {
const port = process.env.PORT || 3000
mainWindow = new BrowserWindow({width: 1100, height: 900, useContentSize: true})
mainWindow.on('closed', function () {
mainWindow = null
})
server.listen(port, (err) => {
if (err) {
return console.log(err)
}
console.log(`server is listening on ${port}`)
mainWindow.loadURL('http://localhost:3000')
})
}
app.on('ready', createWindow)
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
if (mainWindow === null) {
createWindow()
}
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.