-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
68 lines (54 loc) · 1.6 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
'use strict';
/**
* Main entry point for Electron application.
*/
process.on('uncaughtException', (error) =>
{
process.emitWarning(`Uncaught exception: ${error}`);
process.exit(1);
});
const { app, BrowserWindow } = require('electron');
// Global reference to the (main) window object.
let mainWindow = null;
const WINDOW_MIN_WIDTH = 800;
const WINDOW_MIN_HEIGHT = 400;
const WINDOW_DEFAULT_WIDTH = 1200;
const WINDOW_DEFAULT_HEIGHT = 900;
/**
* Create the browser (main) window.
*/
function createWindow()
{
/* eslint-disable no-unused-vars */
const Url = require('url');
const Path = require('path');
const windowOptions = {
minWidth: WINDOW_MIN_WIDTH,
minHeight: WINDOW_MIN_HEIGHT,
width: WINDOW_DEFAULT_WIDTH,
height: WINDOW_DEFAULT_HEIGHT,
autoHideMenuBar: true,
icon: './assets/favicon-64px-64px.png',
title: 'ErxiDesk'
};
mainWindow = new BrowserWindow(windowOptions);
// Load index.html from webpack-dev-server at http://localhost:8080/
mainWindow.loadURL('http://localhost:8080/');
// Load index.html
// mainWindow.loadURL(Url.format(
// {
// pathname: Path.join(__dirname, './index.html'),
// protocol: 'file:',
// slashes: true
// }));
// Automatically open Chromium DevTools.
mainWindow.webContents.openDevTools();
// When the window is closed, dereference the window
// object for garbage collection
mainWindow.on('closed', () =>
{
mainWindow = null;
});
}
// When the app is ready, display the window.
app.on('ready', createWindow);