-
Notifications
You must be signed in to change notification settings - Fork 46
/
main.js
69 lines (65 loc) · 2.38 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
65
66
67
68
69
const electron = require('electron');
const app = electron.app;
const Menu = electron.Menu;
const BrowserWindow = electron.BrowserWindow;
const join = require('path').join;
// Replace '..' with 'about-window'
const openAboutWindow = require('..').default;
app.once('window-all-closed', function () {
app.quit();
});
app.once('ready', function () {
let w = new BrowserWindow();
w.once('closed', function () {
w = null;
});
w.loadURL('file://' + join(__dirname, 'index.html'));
const menu = Menu.buildFromTemplate([
{
label: 'Example',
submenu: [
{
label: 'About This App',
click: () =>
openAboutWindow({
icon_path: join(__dirname, 'icon.png'),
copyright: 'Copyright (c) 2015 rhysd',
package_json_dir: __dirname,
open_devtools: process.env.NODE_ENV !== 'production',
}),
},
{
label: 'About This App (custom version entry)',
click: () =>
openAboutWindow({
icon_path: join(__dirname, 'icon.png'),
copyright: 'Copyright (c) 2015 rhysd',
package_json_dir: __dirname,
use_version_info: [
['my version entry 1', 'a.b.c'],
['my version entry 2', 'x.y.z'],
],
}),
},
{
label: 'About This App (modal with close)',
click: () =>
openAboutWindow({
icon_path: join(__dirname, 'icon.png'),
copyright: 'Copyright (c) 2015 rhysd',
package_json_dir: __dirname,
win_options: {
parent: w,
modal: true,
},
show_close_button: 'Close',
}),
},
{
role: 'quit',
},
],
},
]);
app.applicationMenu = menu;
});