-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathindex.js
More file actions
43 lines (35 loc) · 908 Bytes
/
index.js
File metadata and controls
43 lines (35 loc) · 908 Bytes
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
'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.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);
});