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
|
// make sure to enclose the function in parentheses
|
||||||
(function(back) {
|
(function(back) {
|
||||||
let settings = require('Storage').readJSON('planetarium.json',1)||{};
|
let settings = require('Storage').readJSON('planetarium.json',1)||{};
|
||||||
|
function save(key, value) {
|
||||||
|
settings[key] = value;
|
||||||
|
require('Storage').write('planetarium.json',settings);
|
||||||
|
}
|
||||||
const appMenu = {
|
const appMenu = {
|
||||||
'': {'title': 'Planetarium Settings'},
|
'': {'title': 'Planetarium Settings'},
|
||||||
'< Back': back,
|
'< Back': back,
|
||||||
'Star names': {
|
'Star names': {
|
||||||
value: !settings.starnames,
|
value: settings.starnames,
|
||||||
format: v => v ? 'Yes' : 'No',
|
format: v => v ? 'Yes' : 'No',
|
||||||
onchange: v => require('Storage').write('planetarium.json', {starnames: !v}),
|
onchange: (v) => {save('starnames', v)}
|
||||||
},
|
},
|
||||||
'Constellations': {
|
'Constellations': {
|
||||||
value: !settings.constellations,
|
value: settings.constellations,
|
||||||
format: v => v ? 'Yes' : 'No',
|
format: v => v ? 'Yes' : 'No',
|
||||||
onchange: v => require('Storage').write('planetarium.json', {constellations: !v}),
|
onchange: (v) => {save('constellations', v)}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
E.showMenu(appMenu)
|
E.showMenu(appMenu)
|
||||||
|
|
Loading…
Reference in New Issue