How to debug widget not starting?

Posted on
  • I'm trying to use basic widget example from Bangle.js Widgets.

    Using it in IDE with this works:

    WIDGETS = {}; 
    (() => {
      function draw() {
        g.reset();
        g.drawString("X", this.x, this.y);
      }
    
      WIDGETS["mywidget"] = {
        area: "tl",
        width: 28,
        draw: draw
      };
    })()
    Bangle.drawWidgets();
    

    But when I remove first/last lines and upload resulting code to Bangle.js 2 using my local copy of https://banglejs.com/apps the widget is not loaded.

    How can I debug why it is not loaded?

  • ok, the problem was that I had "mywidget.app.js" in metadata.json when it needs to be "mywidget.wid.js".

    I don't think this is documented, at least not in the widget tutorial.

  • I think if you run npm test (or the automatic one that gets run on GitHub) it'll probably tell you there's some kind of problem?

    If you think the tutorial/docs could be improved somewhere then a PR would be great though :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

How to debug widget not starting?

Posted by Avatar for malaire @malaire

Actions