voldisp: some optimization

Hopefully. And also, probably not needed...
master
thyttan 2025-03-20 21:00:46 +01:00
parent fec5eb0804
commit 500296af19
1 changed files with 30 additions and 29 deletions

View File

@ -1,10 +1,4 @@
{
let timeout;
let onMusicVolume = (volPercent)=>{
if (timeout) {clearTimeout(timeout); timeout=undefined;}
if (Bangle.CLOCK) {
const WIDGET_UTILS_HIDE = function() {
//exports.cleanup();
if (!global.WIDGETS) return;
@ -32,6 +26,12 @@
}
};
let timeout;
let onMusicVolume = (volPercent)=>{
if (timeout) {clearTimeout(timeout);}
if (Bangle.CLOCK) {
let isAllWidgetsHidden = true;
if (global.WIDGETS) {
for (var w of global.WIDGETS) {
@ -41,7 +41,7 @@
}
}
}
WIDGET_UTILS_HIDE();
if (!timeout) {WIDGET_UTILS_HIDE();}
let barWidth = g.getWidth()*volPercent/100;
g.
setColor(0x0000).fillRect(0,0,g.getWidth(),24).
@ -58,6 +58,7 @@
} else {
Bangle.load();
}
timeout = undefined;
};
timeout = setTimeout(goAway, 3*1000);
}