mirror of https://github.com/espruino/BangleApps
parent
ccd1cd1f3c
commit
92d3164029
|
@ -26,10 +26,26 @@
|
||||||
dirty = false;
|
dirty = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let settings;
|
||||||
|
|
||||||
|
function loadSettings() {
|
||||||
|
const d = require('Storage').readJSON('weather.json', 1) || {};
|
||||||
|
settings = d.settings || {};
|
||||||
|
}
|
||||||
|
|
||||||
|
function setting(key) {
|
||||||
|
if (!settings) { loadSettings(); }
|
||||||
|
const DEFAULTS = {
|
||||||
|
'expiry': 2*3600000,
|
||||||
|
'hide': false
|
||||||
|
};
|
||||||
|
return (key in settings) ? settings[key] : DEFAULTS[key];
|
||||||
|
}
|
||||||
|
|
||||||
WIDGETS["weather"] = {
|
WIDGETS["weather"] = {
|
||||||
area: "tl",
|
area: "tl",
|
||||||
width: weather.get() ? 20 : 0,
|
width: weather.get() && !setting('hide') ? 20 : 0,
|
||||||
draw: function() {
|
draw: function() {
|
||||||
const w = weather.get();
|
const w = weather.get();
|
||||||
if (!w) return;
|
if (!w) return;
|
||||||
|
|
Loading…
Reference in New Issue