(function() {
global.WIDGETS={};
require("Storage").list(/\.wid\.js$/).forEach(widget=>{try { eval(require("Storage").read(widget)); } catch (e) {print(widget,e);}});
var W = WIDGETS;
WIDGETS = {};
Object.keys(W).sort((a,b)=>(0|W[b].sortorder)-(0|W[a].sortorder)).forEach(k=>WIDGETS[k]=W[k]);
})
So it should work just to have what you're doing... You could check the WIDGETS object and make sure everything is in the order you want and has sortorder set right?
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.
The actual code for loading widgets is:
So it should work just to have what you're doing... You could check the
WIDGETS
object and make sure everything is in the order you want and hassortorder
set right?