You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Hi... Yes, sending the code string to eval is probably the best method. Obviously if you're using some kind of non-secured system you might want to think a bit about security though!

    Executing something using eval can actually alter the state of the root scope (the value doesn't have to be returned), so you can actually just do:

    eval("function foo() { console.log('foo'); }");
    foo();
    

    The other option if you want something more physical is to save the following code:

    function onInit() { eval(require("fs").readFile("boot.js"); }
    

    And then to put any code you have on the SD card.

About

Avatar for Gordon @Gordon started