swiperclocklaunch: ensure we clear old listeners too
Previously we wouldn't clear old listeners, which meant that they'd remain hanging around, potentially interfering with the currently shown app/clock. We now remember to clear them too, so setUI behaves as a proper reset. See #2809 for more details.master
parent
7fa165f421
commit
5ca4db69d7
|
|
@ -1,7 +1,13 @@
|
||||||
(function() {
|
(function() {
|
||||||
var sui = Bangle.setUI;
|
var sui = Bangle.setUI;
|
||||||
|
var oldSwipe;
|
||||||
|
|
||||||
Bangle.setUI = function(mode, cb) {
|
Bangle.setUI = function(mode, cb) {
|
||||||
|
if (oldSwipe && oldSwipe !== Bangle.swipeHandler)
|
||||||
|
Bangle.removeListener("swipe", oldSwipe);
|
||||||
sui(mode,cb);
|
sui(mode,cb);
|
||||||
|
oldSwipe = Bangle.swipeHandler;
|
||||||
|
|
||||||
if(!mode) return;
|
if(!mode) return;
|
||||||
if ("object"==typeof mode) mode = mode.mode;
|
if ("object"==typeof mode) mode = mode.mode;
|
||||||
if (mode.startsWith("clock")) {
|
if (mode.startsWith("clock")) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue