mirror of https://github.com/espruino/BangleApps
swiperclocklaunch: remove `swipeHandler`, operate outside of `setUI`
parent
72658828ac
commit
89f39af200
|
@ -3,19 +3,21 @@
|
|||
var oldSwipe;
|
||||
|
||||
Bangle.setUI = function(mode, cb) {
|
||||
if (oldSwipe && oldSwipe !== Bangle.swipeHandler)
|
||||
if (oldSwipe) {
|
||||
Bangle.removeListener("swipe", oldSwipe);
|
||||
oldSwipe = undefined;
|
||||
}
|
||||
|
||||
sui(mode,cb);
|
||||
oldSwipe = Bangle.swipeHandler;
|
||||
|
||||
if (Bangle.CLOCK) {
|
||||
// clock -> launcher
|
||||
Bangle.swipeHandler = dir => { if (dir<0) Bangle.showLauncher(); };
|
||||
Bangle.on("swipe", Bangle.swipeHandler);
|
||||
oldSwipe = dir => { if (dir<0) Bangle.showLauncher(); };
|
||||
Bangle.on("swipe", oldSwipe);
|
||||
} else if (global.__FILE__ && __FILE__.endsWith(".app.js") && (require("Storage").readJSON(__FILE__.slice(0,-6)+"info",1)||{}).type==="launch") {
|
||||
// launcher -> clock
|
||||
Bangle.swipeHandler = dir => { if (dir>0) load(); };
|
||||
Bangle.on("swipe", Bangle.swipeHandler);
|
||||
oldSwipe = dir => { if (dir>0) load(); };
|
||||
Bangle.on("swipe", oldSwipe);
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
|
Loading…
Reference in New Issue