Continuing from the other thread, I think this would be great:
//Your networking code here
var bootcode = require('bootcode').init();
Where init goes through and takes a record of the existing modules, vars, etc and stores them. Then it links bootcode.reset to the native reset function, replaces reset() with a function that resets and deletes everything that's not required. If your networking code is all stored in a module too, you only need to put this into your Espruino when you first run it:
var wifi = require('my network').init();var bootcode = require('bootcode').init();
@Gordon - Coming from someone who doesn't know a lot about the internals, would it be possible to add a step in compilation that writes a .js file into the binary as an initial program? It would also be useful for the boards you sell, as you could send them out with a tutorial built into them.
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.
Continuing from the other thread, I think this would be great:
Where init goes through and takes a record of the existing modules, vars, etc and stores them. Then it links bootcode.reset to the native reset function, replaces reset() with a function that resets and deletes everything that's not required. If your networking code is all stored in a module too, you only need to put this into your Espruino when you first run it:
@Gordon - Coming from someone who doesn't know a lot about the internals, would it be possible to add a step in compilation that writes a .js file into the binary as an initial program? It would also be useful for the boards you sell, as you could send them out with a tutorial built into them.