-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
37 lines (31 loc) · 839 Bytes
/
main.ts
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
import { app, BrowserWindow } from 'electron';
import * as path from 'path';
import * as url from 'url';
let mainWindow: Electron.BrowserWindow;
let windowConfig: Electron.BrowserWindowConstructorOptions;
let serve;
const args = process.argv.slice(1);
serve = args.some(val => val === '--serve');
windowConfig = {
width: 800,
height: 700,
//frame: false
};
function createWindow() {
mainWindow = new BrowserWindow(windowConfig);
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'dist/index.html'),
protocol: 'file:',
slashes: true
}));
mainWindow.webContents.openDevTools({
mode: 'undocked'
});
mainWindow.on('closed', () => {
mainWindow = null;
});
}
app.on('ready', createWindow);
app.on('window-all-closed', () => {
app.quit();
});