forked from Bellisario/node-snapdrop
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.js
41 lines (33 loc) · 815 Bytes
/
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
const {app,BrowserWindow} = require('electron')
if (require('electron-squirrel-startup')) return app.quit();
const server = require('./index');
let mainWindow;
function createWindow () {
server();
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
mainWindow.setIcon(__dirname + '/public/images/favicon-96x96.png');
mainWindow.loadURL('http://localhost:3001/');
mainWindow.on('closed', function () {
mainWindow = null
})
}
app.on('ready', createWindow);
app.on('resize', function(e,x,y){
mainWindow.setSize(x, y);
});
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', function () {
if (mainWindow === null) {
createWindow();
}
});