-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
52 lines (43 loc) · 1.15 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
'use strict';
var BrowserWindow = require('browser-window');
var Menu = require('menu');
var app = require('app');
var dialog = require('dialog');
var mainWindow = null;
var template = [{
label: 'File',
submenu: [{
label: 'Quit',
accelerator: 'Command+Q',
click: function() {
app.quit();
}
}]
}];
app.on('window-all-closed', function onWindowAllClosed() {
app.quit();
});
app.on('ready', function onReady() {
mainWindow = new BrowserWindow({
width: 1024,
height: 600,
titleBarStyle: 'hidden'
});
var menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
delete mainWindow.module;
if (process.env.ELECTRON_ENV === 'development') {
mainWindow.openDevTools();
mainWindow.loadURL('http://localhost:5000');
} else {
mainWindow.loadURL('file://' + __dirname + '/dist/index.html');
}
mainWindow.on('closed', function onClosed() {
mainWindow = null;
});
});
function onFileOpen(files) {
if (files && files.length) {
mainWindow.webContents.send('filesOpened', JSON.stringify(files));
}
}