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

View File

@ -181,7 +181,7 @@
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};
setWidth();

View File

@ -11,7 +11,7 @@
// the name still needs to be "messages": the library calls WIDGETS["messages'].hide()/show()
// see e.g. widmsggrid
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 (WIDGETS["messages"].i) {
clearTimeout(WIDGETS["messages"].i);
@ -42,7 +42,7 @@
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);
}, onMsg: function(type, msg) {
if (this.hidden) return;