From 8f22d8aa35ccc05e4d29ad7419a866b2faeac94c Mon Sep 17 00:00:00 2001 From: Travis Evans Date: Wed, 17 Jul 2024 15:07:49 -0500 Subject: [PATCH] Ensure settings are saved upon Bangle2 button long-press --- apps/timestamplog/lib.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/timestamplog/lib.js b/apps/timestamplog/lib.js index 13cb291ef..59590bfb7 100644 --- a/apps/timestamplog/lib.js +++ b/apps/timestamplog/lib.js @@ -141,14 +141,17 @@ function launchSettingsMenu(backCb) { const stampLog = new StampLog(LOG_FILENAME, SETTINGS.maxLogLength); function saveSettings() { + console.log('Saving timestamp log and settings'); stampLog.save(); if (!storage.writeJSON(SETTINGS_FILENAME, SETTINGS)) { E.showAlert('Trouble saving settings'); } } + E.on('kill', saveSettings); function endMenu() { saveSettings(); + E.removeListener('kill', saveSettings); backCb(); }