Another option: maybe support format on functions:
format
// L295: changed from // } else if ("function" == typeof item) { // g.drawImage(/* 9x18 */atob("CRKBAGA4Hg8DwPB4HgcDg8PB4eHg8HAwAA=="), r.x+r.w-21, r.y+H/2-9); // pad += 16; } else if ("function" == typeof item && item.format) { var l=item.format(item.value); g.setFontAlign(1,0).drawString(l,r.x+r.w-8,r.y+H/2); pad += g.stringWidth(l); } ... var mainmenu = { ... "A menu item" : function() { LED1.toggle(); }, "Submenu" : function() { E.showMenu(submenu); }, ... }; mainmenu.Submenu.format= ()=>'\0'+atob("CRKBAGA4Hg8DwPB4HgcDg8PB4eHg8HAwAA==");
Sadly this means you can't just use a single object as menu definition :-(
Edit: or how about we just look if the label ends with ">"? It would require app changes, but nothing breaking.
@rigrig started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Another option: maybe support
format
on functions:Sadly this means you can't just use a single object as menu definition :-(
Edit: or how about we just look if the label ends with ">"? It would require app changes, but nothing breaking.