Both - non-JSON and JSON - ways fail... I suspect that the new feature to load modules as a function meddles with the previous workings... may be the issue is with both, upload AND pull ( require("..."); )...
@Gordon, could it be that the feature of saving modules as functions is doing things differently?
// credsObjTest.js
var creds = require("credsTest");
function onInit() {
console.log("creds object:");
console.log(creds);
console.log("Modules as loaded:");
console.log(Modules.getCached());
}
// for the laxy developer at development time:
setTimeout(onInit,1000);
The last line is only that I do not have to enter onInit() in the console. Saving the code without the last line on my PICO I get following output (...because save() invokes onInit() and I'm still connected):
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.
Tried in console the following... according to Modules reference:
Both - non-JSON and JSON - ways fail... I suspect that the new feature to load modules as a function meddles with the previous workings... may be the issue is with both, upload AND pull (
require("...");
)...@Gordon, could it be that the feature of saving modules as functions is doing things differently?
*** BUT*** *** BUT*** *** BUT*** *** BUT*** *** BUT***
Doing it in a module:
...and in the code as follows:
...I get this output on upload:
The last line is only that I do not have to enter
onInit()
in the console. Saving the code without the last line on my PICO I get following output (...becausesave()
invokesonInit()
and I'm still connected):@ClearMemory041063, I do not know what it fighting you...
@Gordon, made another try in the console with (modules source code and not just source code):
And it works, works, works,... nothing is broken... (so: @Gordon, never mind my comments from before...)