• Hi,
    I am trying to write a widget that shows the currently played track.
    I have the following code:

    //WIDGETS = {};
    
    (() => {
      var musicInfo;
      
      var _GB = global.GB;
      global.GB = (event) => {
        switch (event.t) {
          case "musicinfo":
            musicInfo = event;
            WIDGETS["mymusic"].draw();
            break;
        }
        if(_GB)setTimeout(_GB,0,event);
      };
      
      function draw() {
        g.reset();
        g.clearRect(this.x,this.y,this.x+176,thi­s.y+16);
        g.setFont("Vector",16);
        
        if (musicInfo !== undefined) {
          g.drawString(musicInfo.track,this.x,this­.y);
        }
      }
      
      WIDGETS["mymusic"]={area:"bl",width:176,­draw:draw};
    })();
    
    //Bangle.drawWidgets();
    

    When loading into RAM it works. When using the left side of Espruino Web IDE and sending GB messages, the tracks are displayed.
    However, when loading the code in storage, it does not work. No tracks are displayed.
    What is the difference between RAM and storage?

About

Avatar for ingo @ingo started