-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
45 lines (37 loc) · 915 Bytes
/
index.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
'use strict'
const app = require('electron').app
const ipc = require('electron').ipcMain
const shell = require('electron').shell
const config = require('./config')
const createMainMenu = require('./menu')
const createMainWindow = require('./window')
require('electron-debug')()
let mainWindow
function handleResize () {
if (!mainWindow.isFullScreen()) {
config.set('lastWindowState', mainWindow.getBounds())
}
}
function handleClosed () {
mainWindow = null
}
app.on('window-all-closed', () => {
if (process.platform === 'darwin') {
app.hide()
} else {
app.quit()
}
})
app.on('activate', () => {
if (!mainWindow) {
mainWindow = createMainWindow(handleResize, handleClosed)
}
})
app.on('ready', () => {
mainWindow = createMainWindow(handleResize, handleClosed)
createMainMenu()
})
ipc.on('clicklink', (event, url) => {
event.preventDefault()
shell.openExternal(url)
})