mirror of https://github.com/espruino/BangleApps
bug in settings. fixing
parent
5a91bc5611
commit
f883fab51e
|
@ -1,18 +1,22 @@
|
|||
// make sure to enclose the function in parentheses
|
||||
(function(back) {
|
||||
let settings = require('Storage').readJSON('planetarium.json',1)||{};
|
||||
function save(key, value) {
|
||||
settings[key] = value;
|
||||
require('Storage').write('planetarium.json',settings);
|
||||
}
|
||||
const appMenu = {
|
||||
'': {'title': 'Planetarium Settings'},
|
||||
'< Back': back,
|
||||
'Star names': {
|
||||
value: !settings.starnames,
|
||||
value: settings.starnames,
|
||||
format: v => v ? 'Yes' : 'No',
|
||||
onchange: v => require('Storage').write('planetarium.json', {starnames: !v}),
|
||||
onchange: (v) => {save('starnames', v)}
|
||||
},
|
||||
'Constellations': {
|
||||
value: !settings.constellations,
|
||||
value: settings.constellations,
|
||||
format: v => v ? 'Yes' : 'No',
|
||||
onchange: v => require('Storage').write('planetarium.json', {constellations: !v}),
|
||||
onchange: (v) => {save('constellations', v)}
|
||||
}
|
||||
};
|
||||
E.showMenu(appMenu)
|
||||
|
|
Loading…
Reference in New Issue