1
0
Fork 0

Fix ABI of widget.draw()

master
Rob Pilling 2023-04-25 22:09:05 +01:00
parent 67d89761b5
commit f46a9f526d
3 changed files with 7 additions and 6 deletions

View File

@ -25,7 +25,7 @@
} }
} // getNextAlarm } // getNextAlarm
function draw(fromInterval) { function draw(_w, fromInterval) {
if (this.nextAlarm === undefined) { if (this.nextAlarm === undefined) {
let alarm = getNextAlarm(); let alarm = getNextAlarm();
if (alarm === undefined) { if (alarm === undefined) {
@ -101,8 +101,9 @@
clearTimeout(this.timeoutId); clearTimeout(this.timeoutId);
} }
this.timeoutId = setTimeout(()=>{ this.timeoutId = setTimeout(()=>{
WIDGETS["widalarmeta"].timeoutId = undefined; var w = WIDGETS["widalarmeta"];
WIDGETS["widalarmeta"].draw(true); w.timeoutId = undefined;
w.draw(w, true);
}, timeout); }, timeout);
} /* draw */ } /* draw */

View File

@ -181,7 +181,7 @@
if (on) update(); if (on) update();
}); });
var id = setInterval(()=>WIDGETS["batpc"].draw(true), intervalLow); var id = setInterval(()=>WIDGETS["batpc"].draw(WIDGETS["batpc"], true), intervalLow);
WIDGETS["batpc"]={area:"tr",width:40,draw:draw,reload:reload}; WIDGETS["batpc"]={area:"tr",width:40,draw:draw,reload:reload};
setWidth(); setWidth();

View File

@ -11,7 +11,7 @@
// the name still needs to be "messages": the library calls WIDGETS["messages'].hide()/show() // the name still needs to be "messages": the library calls WIDGETS["messages'].hide()/show()
// see e.g. widmsggrid // see e.g. widmsggrid
WIDGETS["messages"] = { WIDGETS["messages"] = {
area: "tl", width: 0, srcs: [], draw: function(recall) { area: "tl", width: 0, srcs: [], draw: function(_w, recall) {
// If we had a setTimeout queued from the last time we were called, remove it // If we had a setTimeout queued from the last time we were called, remove it
if (WIDGETS["messages"].i) { if (WIDGETS["messages"].i) {
clearTimeout(WIDGETS["messages"].i); clearTimeout(WIDGETS["messages"].i);
@ -42,7 +42,7 @@
this.x+12+i*24, this.y+12, {rotate: 0/*force centering*/}); this.x+12+i*24, this.y+12, {rotate: 0/*force centering*/});
} }
} }
WIDGETS["messages"].i = setTimeout(() => WIDGETS["messages"].draw(true), 1000); WIDGETS["messages"].i = setTimeout(() => WIDGETS["messages"].draw(WIDGETS["messages"], true), 1000);
if (process.env.HWVERSION>1) Bangle.on("touch", this.touch); if (process.env.HWVERSION>1) Bangle.on("touch", this.touch);
}, onMsg: function(type, msg) { }, onMsg: function(type, msg) {
if (this.hidden) return; if (this.hidden) return;