|
10 | 10 | hadBackWidget = true; // if we had a back widget already, don't redraw at the end
|
11 | 11 | WIDGETS.back.remove(options.back); // only redraw when removing if we don't have options.back
|
12 | 12 | }
|
13 |
| - let clearBtnWatches = function() { |
| 13 | + if (Bangle.btnWatches) { |
14 | 14 | Bangle.btnWatches.forEach(clearWatch);
|
15 | 15 | delete Bangle.btnWatches;
|
16 | 16 | }
|
17 |
| - if (Bangle.btnWatches) clearBtnWatches(); |
18 | 17 | if (Bangle.swipeHandler) {
|
19 | 18 | Bangle.removeListener("swipe", Bangle.swipeHandler);
|
20 | 19 | delete Bangle.swipeHandler;
|
|
119 | 118 | if (options.redraw) // handler for redrawing the UI
|
120 | 119 | Bangle.uiRedraw = options.redraw;
|
121 | 120 | if (options.back) {
|
122 |
| - let isBtnBackFunc = false; |
123 | 121 | // only add back button handler if there's no existing watch on BTN1
|
124 | 122 | if (Bangle.btnWatches===undefined) {
|
125 | 123 | Bangle.btnWatches = [ setWatch(function() {
|
126 |
| - Bangle.btnWatches = undefined; |
| 124 | + Bangle.btnWatches = undefined; // watch doesn't repeat |
127 | 125 | options.back();
|
128 | 126 | }, BTN1, {edge:"rising"}) ];
|
129 |
| - isBtnBackFunc = true; |
130 | 127 | }
|
131 | 128 | // if we have widgets loaded *and* visible at the top, add a back widget (see #3788)
|
132 | 129 | if (global.WIDGETS && Bangle.appRect.y) {
|
|
146 | 143 | remove:function(noclear){
|
147 | 144 | var w = WIDGETS.back;
|
148 | 145 | if (w.area!="tl") noclear=true; // area="" is set by widget_utils.hide, so avoid drawing
|
149 |
| - if (isBtnBackFunc && Bangle.btnWatches) clearBtnWatches(); |
150 | 146 | Bangle.removeListener("touch", touchHandler);
|
151 | 147 | if (!noclear) g.reset().clearRect({x:w.x, y:w.y, w:24,h:24});
|
152 | 148 | delete WIDGETS.back;
|
|
0 commit comments