2019-01-05 18:49:52 +03:00
|
|
|
// Based on https://github.com/electron/electron-quick-start
|
|
|
|
|
2019-01-10 21:51:14 +03:00
|
|
|
const { app, BrowserWindow } = require('electron');
|
2019-01-05 18:49:52 +03:00
|
|
|
const argv = require('minimist')(process.argv.slice(2));
|
|
|
|
|
2019-01-10 21:51:14 +03:00
|
|
|
function createWindow() {
|
2021-06-06 22:18:49 +03:00
|
|
|
const mainWindow = new BrowserWindow({
|
2019-01-05 18:49:52 +03:00
|
|
|
width: 800,
|
|
|
|
height: 600,
|
2019-01-10 21:51:14 +03:00
|
|
|
});
|
2019-01-05 18:49:52 +03:00
|
|
|
|
2023-01-08 22:25:09 +03:00
|
|
|
const port = argv.port ? argv.port : 8000;
|
|
|
|
const host = argv.host ? argv.host : 'localhost';
|
|
|
|
const protocol = argv.protocol ? argv.protocol : 'http';
|
|
|
|
|
|
|
|
mainWindow.loadURL(protocol + '://' + host + ':' + port);
|
2019-01-05 18:49:52 +03:00
|
|
|
}
|
|
|
|
|
2021-06-06 22:18:49 +03:00
|
|
|
app.whenReady().then(() => {
|
|
|
|
createWindow();
|
2019-01-05 18:49:52 +03:00
|
|
|
|
2021-06-06 22:18:49 +03:00
|
|
|
app.on('activate', function () {
|
|
|
|
if (BrowserWindow.getAllWindows().length === 0) createWindow();
|
|
|
|
});
|
2019-01-10 21:51:14 +03:00
|
|
|
});
|
2019-01-05 18:49:52 +03:00
|
|
|
|
2021-06-06 22:18:49 +03:00
|
|
|
app.on('window-all-closed', function () {
|
|
|
|
if (process.platform !== 'darwin') app.quit();
|
2019-01-10 21:51:14 +03:00
|
|
|
});
|