diff --git a/apps/widminbate/ChangeLog b/apps/widminbate/ChangeLog index c1952a33d..56c73beca 100644 --- a/apps/widminbate/ChangeLog +++ b/apps/widminbate/ChangeLog @@ -3,3 +3,4 @@ 0.03: Do not clear outside of widget bar 0.04: Fork `widminbat`->`widminbate`. Only use the system theme foreground colour. +0.05: Fix broken fork which removed the `update` function \ No newline at end of file diff --git a/apps/widminbate/metadata.json b/apps/widminbate/metadata.json index dfa5a69fa..5fed8eef5 100644 --- a/apps/widminbate/metadata.json +++ b/apps/widminbate/metadata.json @@ -1,7 +1,7 @@ { "id": "widminbate", "name": "Extra Minimal Battery", "shortName":"ExtraMinBat", - "version":"0.04", + "version":"0.05", "description": "An extra minimal (only use system theme foreground colour) version of the battery widget that only appears if the battery is running low (below 30%)", "icon": "widget.png", "type": "widget", diff --git a/apps/widminbate/widget.js b/apps/widminbate/widget.js index 0bf4ceee3..4d4cbbe49 100644 --- a/apps/widminbate/widget.js +++ b/apps/widminbate/widget.js @@ -1,7 +1,7 @@ -(()=>{ - function getWidth() { +{ + let getWidth = function() { return E.getBattery() <= 30 || Bangle.isCharging() ? 40 : 0; - } + }; WIDGETS.minbate={area:"tr",width:getWidth(),draw:function() { if(this.width < 40) return; var s = 39; @@ -12,6 +12,7 @@ clearRect(x,y,x+s,y+23). setColor(g.theme.fg).fillRect(x,y+2,x+s-4,y+21).clearRect(x+2,y+4,x+s-6,y+19).fillRect(x+s-3,y+10,x+s,y+14).//border fillRect(x+4,y+6,x+4+barWidth,y+17);//indicator bar + },update: function() { var newWidth = getWidth(); if(newWidth != this.width) { this.width = newWidth; @@ -22,7 +23,7 @@ }}; setInterval(()=>{ var widget = WIDGETS.minbate; - if(widget) {widget.update();} + if(widget) widget.update(); }, 10*60*1000); Bangle.on('charging', () => WIDGETS.minbate.update()); -})(); +} \ No newline at end of file