You are reading a single comment by @rigrig and its replies. Click here to read the full conversation.
  • One problem is you can't go back from the app settings to the settings menu.

    You could maybe put the drawing code in a separate library file, like e.g. the weather app does, so you'd have something like this:

    // apps/contourclock/lib.js
    exports.drawClock = function(time, face) {
      // draw clockface [#face](https://forum.espruino.com/search/?q=%23face), at given time
    }
    
    // apps/contourclock/app.js
    var face = Storage.readJSON('contourclock.json').face
    setInterval(()=>require('contourclock').drawClock(new Date(), face), 60000);
    
    // apps/contourclock/settings.js
    (function(back) {
    function preview(face) {
      require('contourclockclock').drawClock(new Date(), face);
    }
    // settings menu using preview() goes here
    })
    
    // apps.json
    {
      "id": "contourclock"
    "storage": [
          {"name":"contourclock.app.js","url":"app.js"},
          {"name":"contourclock","url":"lib.js"},
          {"name":"contourclock.settings.js","url":"settings.js"}
        ],
    }
    
About

Avatar for rigrig @rigrig started