Skip to content

Commit

Permalink
lightswitch 0.08: Ensure boot code doesn't allocate and leave a glova…
Browse files Browse the repository at this point in the history
…l variable named 'settings'
  • Loading branch information
gfwilliams committed Sep 11, 2023
1 parent ca74c9a commit aad6513
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions apps/lightswitch/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
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.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'
7 changes: 3 additions & 4 deletions apps/lightswitch/boot.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
// load settings
var settings = Object.assign({
let settings = Object.assign({
value: 1,
isOn: true
}, require("Storage").readJSON("lightswitch.json", true) || {});
Expand All @@ -12,6 +13,4 @@ Bangle.removeListener("tap", require("lightswitch.js").tapListener);

// add tap listener to unlock and/or flash backlight
if (settings.unlockSide || settings.tapSide) Bangle.on("tap", require("lightswitch.js").tapListener);

// clear variable
settings = undefined;
}
2 changes: 1 addition & 1 deletion apps/lightswitch/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "lightswitch",
"name": "Light Switch Widget",
"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.",
"icon": "images/app.png",
"screenshots": [
Expand Down

0 comments on commit aad6513

Please sign in to comment.