Update widget.js

master
Phil Roggenbuck 2023-02-14 15:54:06 +01:00 committed by GitHub
parent 1485ee8624
commit 1c9d62fe0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -6,6 +6,7 @@
let settings; let settings;
function loadSettings() { // stolen from https://github.com/espruino/BangleApps/blob/master/apps/widpedom/widget.js function loadSettings() { // stolen from https://github.com/espruino/BangleApps/blob/master/apps/widpedom/widget.js
try {
const d = require('Storage').readJSON("widbgjs.settings.json", 1) || {}; const d = require('Storage').readJSON("widbgjs.settings.json", 1) || {};
settings = Object.assign({ settings = Object.assign({
'unitIsMmol': true, 'unitIsMmol': true,
@ -14,6 +15,9 @@
'hide': false 'hide': false
}, d || {}); }, d || {});
return d; return d;
} catch(e){
return null;
}
} }
function loadVals() { function loadVals() {
@ -103,9 +107,9 @@
function draw() { function draw() {
loadSettings(); loadSettings();
try { if(settings.hide) {
if (settings.hide) return; return;
} catch (e) { } }
loadVals(); loadVals();
outpt = getBG(storedData.bg); outpt = getBG(storedData.bg);