mirror of https://github.com/espruino/BangleApps
Ensure settings are saved upon Bangle2 button long-press
parent
f7badead2c
commit
8f22d8aa35
|
@ -141,14 +141,17 @@ function launchSettingsMenu(backCb) {
|
||||||
const stampLog = new StampLog(LOG_FILENAME, SETTINGS.maxLogLength);
|
const stampLog = new StampLog(LOG_FILENAME, SETTINGS.maxLogLength);
|
||||||
|
|
||||||
function saveSettings() {
|
function saveSettings() {
|
||||||
|
console.log('Saving timestamp log and settings');
|
||||||
stampLog.save();
|
stampLog.save();
|
||||||
if (!storage.writeJSON(SETTINGS_FILENAME, SETTINGS)) {
|
if (!storage.writeJSON(SETTINGS_FILENAME, SETTINGS)) {
|
||||||
E.showAlert('Trouble saving settings');
|
E.showAlert('Trouble saving settings');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
E.on('kill', saveSettings);
|
||||||
|
|
||||||
function endMenu() {
|
function endMenu() {
|
||||||
saveSettings();
|
saveSettings();
|
||||||
|
E.removeListener('kill', saveSettings);
|
||||||
backCb();
|
backCb();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue