BangleApps/apps/widday/widget.js

28 lines
923 B
JavaScript
Raw Permalink Normal View History

2022-05-26 16:30:12 +00:00
(() => {
var width = 32; // width of the widget
function draw() {
var date = new Date();
g.reset(); // reset the graphics context to defaults (color/font/etc)
g.setFontAlign(0,1); // center fonts
//g.drawRect(this.x, this.y, this.x+width-1, this.y+23); // check the bounds!
2022-06-06 11:52:26 +00:00
var text = date.getDate();
2022-05-26 16:30:12 +00:00
g.setFont("Vector", 24);
g.drawString(text, this.x+width/2+1, this.y + 28);
//g.setColor(0, 0, 1);
//g.drawRect(this.x, this.y, this.x+width-2, this.y+1);
}
setInterval(function() {
2022-05-26 16:33:19 +00:00
WIDGETS["widday"].draw(WIDGETS["widdateday"]);
2022-05-26 16:30:12 +00:00
}, 10*60000); // update every 10 minutes
// add your widget
2022-05-26 16:33:19 +00:00
WIDGETS["widday"]={
2022-05-26 16:30:12 +00:00
area:"bl", // tl (top left), tr (top right), bl (bottom left), br (bottom right)
width: width, // how wide is the widget? You can change this and call Bangle.drawWidgets() to re-layout
draw:draw // called to draw the widget
};
})()