diff --git a/apps/lightswitch/ChangeLog b/apps/lightswitch/ChangeLog index 398d146e0c..a14d85e21f 100644 --- a/apps/lightswitch/ChangeLog +++ b/apps/lightswitch/ChangeLog @@ -5,4 +5,5 @@ 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' \ No newline at end of file +0.08: Ensure boot code doesn't allocate and leave a gloval variable named 'settings' +0.09: Handle lightswitch logic running before its widget has loaded diff --git a/apps/lightswitch/lib.js b/apps/lightswitch/lib.js index eb720e69a7..3dd07579c8 100644 --- a/apps/lightswitch/lib.js +++ b/apps/lightswitch/lib.js @@ -6,7 +6,7 @@ exports = { // check for double tap and direction if (data.double) { // setup shortcut to this widget or load from storage - var w = global.WIDGETS ? WIDGETS.lightswitch : Object.assign({ + var w = global.WIDGETS && WIDGETS.lightswitch || Object.assign({ unlockSide: "", tapSide: "right", tapOn: "always", @@ -31,7 +31,7 @@ exports = { // function to flash backlight flash: function(tOut) { // setup shortcut to this widget or load from storage - var w = global.WIDGETS ? WIDGETS.lightswitch : Object.assign({ + var w = global.WIDGETS && WIDGETS.lightswitch || Object.assign({ tOut: 3000, minFlash: 0.2, value: 1, diff --git a/apps/lightswitch/metadata.json b/apps/lightswitch/metadata.json index f33f6d1cbf..8eef08952d 100644 --- a/apps/lightswitch/metadata.json +++ b/apps/lightswitch/metadata.json @@ -2,7 +2,7 @@ "id": "lightswitch", "name": "Light Switch Widget", "shortName": "Light Switch", - "version": "0.08", + "version": "0.09", "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": [