1
0
Fork 0

lightswitch 0.08: Ensure boot code doesn't allocate and leave a gloval variable named 'settings'

master
Gordon Williams 2023-09-11 14:56:57 +01:00
parent ca74c9a1c3
commit aad6513989
3 changed files with 5 additions and 5 deletions

View File

@ -5,3 +5,4 @@
0.05: Prevent drawing into app area. 0.05: Prevent drawing into app area.
0.06: Fix issue where .draw was being called by reference (not allowing widgets to be hidden) 0.06: Fix issue where .draw was being called by reference (not allowing widgets to be hidden)
0.07: Handle the swipe event that is generated when draging to change light intensity, so it doesn't trigger some other swipe handler. 0.07: Handle the swipe event that is generated when draging to change light intensity, so it doesn't trigger some other swipe handler.
0.08: Ensure boot code doesn't allocate and leave a gloval variable named 'settings'

View File

@ -1,5 +1,6 @@
{
// load settings // load settings
var settings = Object.assign({ let settings = Object.assign({
value: 1, value: 1,
isOn: true isOn: true
}, require("Storage").readJSON("lightswitch.json", true) || {}); }, require("Storage").readJSON("lightswitch.json", true) || {});
@ -12,6 +13,4 @@ Bangle.removeListener("tap", require("lightswitch.js").tapListener);
// add tap listener to unlock and/or flash backlight // add tap listener to unlock and/or flash backlight
if (settings.unlockSide || settings.tapSide) Bangle.on("tap", require("lightswitch.js").tapListener); if (settings.unlockSide || settings.tapSide) Bangle.on("tap", require("lightswitch.js").tapListener);
}
// clear variable
settings = undefined;

View File

@ -2,7 +2,7 @@
"id": "lightswitch", "id": "lightswitch",
"name": "Light Switch Widget", "name": "Light Switch Widget",
"shortName": "Light Switch", "shortName": "Light Switch",
"version": "0.07", "version": "0.08",
"description": "A fast way to switch LCD backlight on/off, change the brightness and show the lock status. All in one widget.", "description": "A fast way to switch LCD backlight on/off, change the brightness and show the lock status. All in one widget.",
"icon": "images/app.png", "icon": "images/app.png",
"screenshots": [ "screenshots": [