From fbf5bc62e6dc3fb7cda4cc39df7897e3605ee2c8 Mon Sep 17 00:00:00 2001 From: thelamer Date: Sat, 23 Oct 2021 11:51:32 -0700 Subject: [PATCH] add a beforeunload event to exiting the game launcher to ensure srm files are generated --- frontend/js/index.js | 5 +++-- package.json | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/js/index.js b/frontend/js/index.js index e15b829..4a533ae 100644 --- a/frontend/js/index.js +++ b/frontend/js/index.js @@ -140,9 +140,10 @@ function launch(active_item) { } }, 100); // Reload window if user clicks back - $(window).on('hashchange', function() { + $(window).on('hashchange', async function() { if (window.location.hash !== '#game') { - window.location.reload(); + window.dispatchEvent(new Event('beforeunload')); + setTimeout(function(){window.location.reload();}, 1000); } }); } diff --git a/package.json b/package.json index 6e63ea7..43e7eba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "emulatorjs", - "version": "0.0.1", + "version": "0.0.2", "description": "Rom and art management utility for generating configuration files for use with the EmulatorJS frontend", "main": "index.js", "author": "thelamer",