You are reading a single comment by @Jorgen and its replies. Click here to read the full conversation.
  • Yes, I think it's as easy as eval(require("fs").readFileSync()) - eval should use the current scope.

    Maybe a 'nicer' way of doing it is:

    var myEffect = new Function("any","args","callback",require("fs").readFileSync());
    // file might contain: "console.log(any, args); callback();"
    myEffect("Hello","World", function() { 
     ...
    });
    

    So then you pass in what you want as arguments, and you load the code in as a function - so it's easy to just delete that function later if you want to free the memory.

    ... maybe wait for 1v80 before you try writing to the SD card though - @JumJum discovered a bug in 1v73 - 1v79 that could corrupt SD card contents.

  • @Gordon you are the man! Thx for the fast reply and the awesome short snippet.
    Really good idea to put content to function and execute them directly.
    Do you have any hints for me, when the 1v80 will release? Or did the bugfix already exsists on GitHub?

    Before I implement this stuff, I have to wait for the ESP12 board from OSHPark and try out the WiFi communication. Next step is to add small library to stream JavaScript content to Pico. Last step is to store this content (effect functions) to SD for later use...

About

Avatar for Jorgen @Jorgen started