-
Notifications
You must be signed in to change notification settings - Fork 14
/
app.js
74 lines (56 loc) · 1.67 KB
/
app.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
70
71
72
73
74
const app = require('electron').app;
const path = require('path');
const window = require('electron-window');
const shell = require('electron').shell;
const electron = require('electron');
const BrowserWindow = electron.BrowserWindow;
var readFile = null;
// require('electron-debug')({showDevTools: true});
process.argv.forEach(function (val, index, array) {
if (index == 2) {
readFile = val;
} else {
readfile = null;
}
});
function createWindow() {
var options = {
width: 800,
height: 600,
icon: 'assets/icon.png',
javascript : false
};
let mainWindow;
mainWindow = window.createWindow(options);
let args = {
file: readFile
};
mainWindow.setMenu(null);
// mainWindow.setFullScreen(true)
mainWindow.showUrl(__dirname + '/index.html', args);
mainWindow.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.
mainWindow = null
});
//mainWindow.maximize - just to test
mainWindow.on('maximize', function () {
});
return mainWindow;
}
app.on('ready', function () {
mainWindow = createWindow();
mainWindow.on('resize', function () {
//console.log('resize');
});
});
app.on('activate', function () {
mainWindow.restore();
});
app.on('before-quit', function () {
// Not used. Just to remember the options
}) ;
app.on('open-file', function () {
// Not used. Just to remember the options
}) ;