add timeout to clock

pull/2576/head
thyttan 2023-02-13 21:56:52 +01:00
parent c8a4f5bb98
commit 334d196108
1 changed files with 11 additions and 1 deletions

View File

@ -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();
} }