mirror of https://github.com/espruino/BangleApps
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.pull/2809/head
parent
7fa165f421
commit
5ca4db69d7
|
@ -1,7 +1,13 @@
|
|||
(function() {
|
||||
var sui = Bangle.setUI;
|
||||
var oldSwipe;
|
||||
|
||||
Bangle.setUI = function(mode, cb) {
|
||||
if (oldSwipe && oldSwipe !== Bangle.swipeHandler)
|
||||
Bangle.removeListener("swipe", oldSwipe);
|
||||
sui(mode,cb);
|
||||
oldSwipe = Bangle.swipeHandler;
|
||||
|
||||
if(!mode) return;
|
||||
if ("object"==typeof mode) mode = mode.mode;
|
||||
if (mode.startsWith("clock")) {
|
||||
|
|
Loading…
Reference in New Issue