From d801e39c44ff68dba48c604a83c6bd5e96bf2cc8 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 20 May 2024 01:04:48 +0200 Subject: [PATCH] Fixed close bug 2 --- neutralino.config.json | 2 +- src/index.html | 2 +- src/index.js | 11 ++++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/neutralino.config.json b/neutralino.config.json index 220e258..570bdfa 100644 --- a/neutralino.config.json +++ b/neutralino.config.json @@ -46,7 +46,7 @@ "maximize": false, "hidden": false, "resizable": true, - "exitProcessOnClose": true + "exitProcessOnClose": false }, "browser": { "globalVariables": { diff --git a/src/index.html b/src/index.html index 87836fb..d2139b7 100644 --- a/src/index.html +++ b/src/index.html @@ -3,6 +3,7 @@ Cooperate Cleaner + @@ -19,6 +20,5 @@ because `neu update` typically downloads it. Avoid copy-pasting it. --> - diff --git a/src/index.js b/src/index.js index 91a6ac6..c6df363 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,5 @@ -$(document).ready(function() { +Neutralino.init(); +$(document).ready(async function() { // Load navbar $('#navbar').load('components/navbar.html', function() { // Attach click event to navbar links @@ -15,6 +16,12 @@ $(document).ready(function() { // Load the initial view const initialView = location.hash.replace('#', '') || 'home'; loadView(initialView); + + // Enable window close event + await Neutralino.events.on('windowClose', () => { + Neutralino.app.exit(); + }); + }); function loadView(view) { @@ -44,3 +51,5 @@ function loadView(view) { }); } + +