Tried to fix bug in settings

pull/2099/head
aaronrolls 2022-08-23 09:32:17 +12:00
parent ec7e58a14d
commit cf18ecc312
1 changed files with 18 additions and 18 deletions

View File

@ -6,32 +6,32 @@
(function(back) {
// default to buzzing
var FILE = "chimer.json"
var settings = {}
const chimes = ["Off", "Buzz", "Beep", "Both"]
const frequency = ["60 min", "30 min", "15 min"]
var FILE = "chimer.json";
var settings = {};
const chimes = ["Off", "Buzz", "Beep", "Both"];
const frequency = ["60 min", "30 min", "15 min"];
const menu = {
"": {"title": "Hour Chime"},
"< Back": back,
"": {"title": "Chimer"},
"< Back": () => back(),
"Chime Type": {
value: settings.type,
min: 0, max: 2, // both is just silly
format: v => chimes[v],
onchange: function(v) {
settings.type = v
writeSettings(settings)
min: 0, max: 2,step: 1, // both is just silly
format: (value) => chimes[value],
onchange: (value) => {
settings.type = value;
writeSettings(settings);
},
},
"Frequency": {
value: settings.freq,
min: 0, max: 2,
format: v => frequency[v],
onchange : function(v) {
settings.freq = v
writeSettings(settings)
min: 0, max: 2, step: 1,
format: (value) => frequency[value],
onchange : (value) => {
settings.freq = value;
writeSettings(settings);
}
}
}
@ -48,7 +48,7 @@
var writeSettings = (settings) => {
require("Storage").writeJSON(FILE, settings);
};
settings = readSettings()
E.showMenu(menu)
settings = readSettings();
E.showMenu(menu);
})