BangleApps/apps/_example_widget/widget.js

17 lines
554 B
JavaScript
Raw Normal View History

/* run widgets in their own function scope so they don't interfere with
currently-running apps */
(() => {
2020-02-07 17:09:18 +00:00
function draw() {
2020-02-13 11:47:59 +00:00
g.reset(); // reset the graphics context to defaults (color/font/etc)
// add your code
g.drawString("X", this.x, this.y);
2020-02-07 17:09:18 +00:00
}
2020-02-07 17:09:18 +00:00
// add your widget
WIDGETS["mywidget"]={
area:"tl", // tl (top left), tr (top right), bl (bottom left), br (bottom right)
width: 28, // how wide is the widget? You can change this and call Bangle.drawWidgets() to re-layout
draw:draw // called to draw the widget
};
})()