From d8ada3f734c11f39669b51402840aa45feda2ce6 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Tue, 30 Jan 2024 16:36:44 +0000 Subject: [PATCH] Refactor to remove the (apparently spurious) `Error: Unreachable point. logically broken.` warning during minification --- modules/widget_utils.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/widget_utils.js b/modules/widget_utils.js index 1c7d0ed28..9d20e6803 100644 --- a/modules/widget_utils.js +++ b/modules/widget_utils.js @@ -47,7 +47,7 @@ exports.cleanup = function() { Bangle.drawWidgets = exports.origDraw; delete exports.origDraw; } -} +}; /** Put widgets offscreen, and allow them to be swiped back onscreen with a downwards swipe. Use .show to undo. @@ -87,8 +87,7 @@ exports.swipeOn = function(autohide) { else Bangle.setLCDOverlay(); } - for (var w of global.WIDGETS) { - if (w._draw) continue; // already hidden + for (var w of global.WIDGETS) if (!w._draw) { // already hidden w._draw = w.draw; w.draw = function() { g=og; @@ -139,10 +138,9 @@ exports.swipeOn = function(autohide) { exports.hideTimeout = setTimeout(function() { anim(-4); }, exports.autohide); - } + }; if (ud>0 && offset<0) anim(4, cb); if (ud<0 && offset>-24) anim(-4); - }; Bangle.on("swipe", exports.swipeHandler); Bangle.drawWidgets();