BangleApps/apps/widclkbttm/widclkbttm.wid.js

17 lines
722 B
JavaScript
Raw Normal View History

WIDGETS["wdclkbttm"]={area:"br",width:Bangle.CLOCK?0:60,draw:function() {
if (!Bangle.CLOCK == !this.width) { // if we're the wrong size for if we have a clock or not...
2023-01-05 21:44:31 +00:00
this.width = Bangle.CLOCK?0:60;
return setTimeout(Bangle.drawWidgets,1); // widget changed size - redraw
2021-09-14 11:06:18 +00:00
}
if (!this.width) return; // if not visible, return
2022-12-15 22:59:52 +00:00
g.reset().setFont("6x8", 2).setFontAlign(-1, 0);
var time = require("locale").time(new Date(),1);
g.drawString(time, this.x, this.y+11, true); // 5 * 6*2 = 60
// queue draw in one minute
if (this.drawTimeout) clearTimeout(this.drawTimeout);
this.drawTimeout = setTimeout(()=>{
this.drawTimeout = undefined;
this.draw();
}, 60000 - (Date.now() % 60000));
}};