From 8ccd33d2b029a4356abb8dc5f9d80dfb2cf8b21d Mon Sep 17 00:00:00 2001 From: koneko <67551503+koneko@users.noreply.github.com> Date: Wed, 8 Jan 2025 20:40:46 +0100 Subject: [PATCH] prevent accidental refreshes in production --- public/latest_commit | 2 +- src/main.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/public/latest_commit b/public/latest_commit index 6ab709b..386583d 100644 --- a/public/latest_commit +++ b/public/latest_commit @@ -1 +1 @@ -2f2a5s \ No newline at end of file +DEVELOPMENT \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 5c9990c..26354e5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -59,4 +59,9 @@ import { log } from './utils'; Globals.GameMaster.changeScene(new MainScene()); let params = new URLSearchParams(location.href); if (params.entries().next().value[1] == 'game') Globals.GameMaster.changeScene(new GameScene('Mission 1')); + + if (Globals.latestCommit != 'DEVELOPMENT') + window.onbeforeunload = () => { + return 'You are about to leave.'; + }; })();