Skip to content

Commit

Permalink
Prepare version 1.0.0
Browse files Browse the repository at this point in the history
* Good enough as a starter template, works a little, and has
  no audit failures. This is ok.
  • Loading branch information
olle committed Apr 7, 2022
1 parent c3b9baf commit 664f433
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 28 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<script>
(function() {
setTimeout(function() {
document.location = 'http://localhost:8080/';
document.location = 'http://localhost:8181/';
}, 5000);
})();
</script>
Expand Down
53 changes: 29 additions & 24 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
(function() {
'use strict';

// For our Java app, we want to spawn it and run in background
var spawn = require('child_process').spawn;
var fs = require('fs');
var out = fs.openSync('./out.log', 'a');
var err = fs.openSync('./out.log', 'a');
var child = spawn('java', ['-jar', __dirname + '/target/app.jar'], {
detached: true,
stdio: ['ignore', out, err]
});
(function () {
"use strict";

// During development we direct STDOUT/STDERR from the backend app to a file
var fs = require("fs");
var out = fs.openSync("./out.log", "a");
var err = fs.openSync("./out.log", "a");

// The backend Java App is spawned to run in the background
var spawn = require("child_process").spawn;
var child = spawn(
"java",
["-Dserver.port=8181", "-jar", __dirname + "/target/app.jar"],
{
detached: true,
stdio: ["ignore", out, err],
}
);
child.unref();

var electron = require('electron');
var electron = require("electron");
var app = electron.app; // Module to control application life.
var BrowserWindow = electron.BrowserWindow; // Module to create native browser window.

Expand All @@ -21,41 +27,40 @@
var mainWindow;

// Quit when all windows are closed.
app.on('window-all-closed', function() {
app.on("window-all-closed", function () {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform != 'darwin') {
if (process.platform != "darwin") {
app.quit();
}
});

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
app.on('ready', function() {
app.on("ready", function () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 1000,
height: 700
height: 700,
});

// and load the index.html of the app.
mainWindow.loadURL('file://' + __dirname + '/index.html');
mainWindow.loadURL("file://" + __dirname + "/index.html?port=8181");

// Open the DevTools.
// Open the DevTools
//mainWindow.webContents.openDevTools();

// Emitted when the window is closed.
mainWindow.on('closed', function() {
mainWindow.on("closed", function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
});

app.on('quit', function() {
// Close and destroy the JAVA process
child.kill('SIGINT');
app.on("quit", function () {
// Close and destroy the backend Java process
child.kill("SIGINT");
});

})();
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "electron-starter",
"version": "0.1.0",
"version": "1.0.0",
"description": "Electron app, starter kit.",
"author": "Olle Törnström",
"license": "MIT",
Expand All @@ -13,7 +13,7 @@
},
"main": "main.js",
"scripts": {
"prestart": "make",
"prestart": "mvn package",
"start": "electron main.js",
"test": "mvn test && jasmine-node ."
},
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>app</artifactId>
<groupId>com.studiomediatech</groupId>
<version>0.0.1</version>
<version>1.0.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
Expand Down

0 comments on commit 664f433

Please sign in to comment.