mirror of https://github.com/espruino/BangleApps
add timeout to clock
parent
c8a4f5bb98
commit
334d196108
|
@ -25,9 +25,19 @@
|
||||||
mode: "custom",
|
mode: "custom",
|
||||||
touch: touchHandler,
|
touch: touchHandler,
|
||||||
swipe : swipeHandler,
|
swipe : swipeHandler,
|
||||||
remove: ()=>{}
|
remove: ()=>{if (timeoutToClock) clearTimeout(timeoutToClock);}
|
||||||
});
|
});
|
||||||
|
|
||||||
g.clearRect(Bangle.appRect);
|
g.clearRect(Bangle.appRect);
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
|
Bangle.drawWidgets();
|
||||||
|
|
||||||
|
// taken from Icon Launcher with some alterations
|
||||||
|
let timeoutToClock;
|
||||||
|
const updateTimeoutToClock = function(){
|
||||||
|
let time=2; // seconds
|
||||||
|
if (timeoutToClock) clearTimeout(timeoutToClock);
|
||||||
|
timeoutToClock = setTimeout(Bangle.showClock,time*1000);
|
||||||
|
};
|
||||||
|
updateTimeoutToClock();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue