simpletimer: make BTN2 really return to launcher
(only while countdown is not running)master
parent
6783472e9a
commit
192ba32a5d
|
|
@ -15,4 +15,5 @@ Simple timer, useful when playing board games or cooking
|
||||||
- Tap on seconds to increase them one by one
|
- Tap on seconds to increase them one by one
|
||||||
- Press BTN3 to reset time to 0
|
- Press BTN3 to reset time to 0
|
||||||
- Press BTN1 to start the timer or reset to the original time
|
- Press BTN1 to start the timer or reset to the original time
|
||||||
|
- Press BTN2 to return to the launcher (only while countdown is not running)
|
||||||
- When the time is up use the [swipeleft](https://github.com/espruino/BangleApps/tree/master/apps/gesture) gesture to reset the timer
|
- When the time is up use the [swipeleft](https://github.com/espruino/BangleApps/tree/master/apps/gesture) gesture to reset the timer
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,6 @@ function reset(value) {
|
||||||
state = value === 0 ? "unset" : "set";
|
state = value === 0 ? "unset" : "set";
|
||||||
}
|
}
|
||||||
|
|
||||||
setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" });
|
|
||||||
function addWatch() {
|
function addWatch() {
|
||||||
clearWatch();
|
clearWatch();
|
||||||
setWatch(changeState, BTN1, {
|
setWatch(changeState, BTN1, {
|
||||||
|
|
@ -119,6 +118,16 @@ function addWatch() {
|
||||||
repeat: true,
|
repeat: true,
|
||||||
edge: "falling"
|
edge: "falling"
|
||||||
});
|
});
|
||||||
|
setWatch(() => {
|
||||||
|
if (state !== "started") {
|
||||||
|
Bangle.showLauncher();
|
||||||
|
}},
|
||||||
|
BTN2,
|
||||||
|
{
|
||||||
|
repeat: false,
|
||||||
|
edge: "falling",
|
||||||
|
},
|
||||||
|
);
|
||||||
setWatch(
|
setWatch(
|
||||||
() => {
|
() => {
|
||||||
reset(0);
|
reset(0);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue