-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
64 lines (54 loc) · 1.65 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
'use strict'
const path = require('path')
const {app, ipcMain, Menu, ipcRenderer, BrowserWindow} = require('electron')
const Window = require('./Window')
function main() {
let mainWindow = new Window({
file: path.join('renderer', 'index.html')
})
let aboutWin
var menu = Menu.buildFromTemplate([
{
label: 'Menu',
submenu: [
{
label: 'About Application',
click() {
// ipcRenderer.send('about-window')
if (!aboutWin) {
// create a new add todo window
aboutWin = new Window({
file: path.join('renderer', 'about.html'),
width: 300,
height: 250,
parent: mainWindow
})
// cleanup
aboutWin.on('closed', () => {
aboutWin = null
})
}
}
},
{type: 'separator'},
{
label: 'Exit',
click() {
app.quit()
}
}
]
}
])
Menu.setApplicationMenu(menu);
//add todo windows
mainWindow.once('show', () => {
})
ipcMain.on('about-window', () => {
// if addTodoWin does not already exist
})
}
app.on('ready', main)
app.on('windows-all-closed', function () {
app.quit()
})