aboutsummaryrefslogtreecommitdiff
path: root/main.js
blob: 6580022ba5ffd6727f48072645380568c7fcb397 (plain)
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
const {app, BrowserWindow} = require('electron')
const path = require('path')
const url = require('url')
let win

function createWindow () {
  // Create the browser window.
  win = new BrowserWindow({
      minWidth: 800, 
      minHeight: 600,
      width: 800, 
      height: 600,
      webPreferences: {
        nodeIntegration: true
      }
  })

  // and load the index.html of the app.
  win.loadURL(url.format({
    pathname: path.join(__dirname, 'app/app.html'),
    protocol: 'file:',
    slashes: true
  }))

  // Open the DevTools.
  // win.webContents.openDevTools()

  // Emitted when the window is closed.
  win.on('closed', () => {
    // Dereference the window object, usually you would store windows
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    win = null
  })
}
app.on('ready', createWindow)

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') {
    app.quit()
  }
})

app.on('activate', () => {
  if (win === null) {
    createWindow()
  }
})