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