You are reading a single comment by @Alex and its replies. Click here to read the full conversation.
  • Hi Gordon,

    I'm not using an SD card with my espruino but most of my projects are made in an IDE other then web IDE. As I prefer to have an object oriented workflow, I often have multiple smaller files which I have to combine when I want to upload them to the espruino.

    I was wondering if it would be possible to link to a few files with the web IDE, change their order and have the webIDE grab their contents and upload the combined package to the espruino.

    So you could write some code like:

    var deployment = "espruino";
    
    require("C:\Webstorm\EspruinoProject\coo­lObjectOne.js");
    require("C:\Webstorm\EspruinoProject\coo­lObjectTwo.js");
    require("C:\Webstorm\EspruinoProject\coo­lObjectThree.js");
    require("C:\Webstorm\EspruinoProject\coo­lObjectFour.js");
    require("C:\Webstorm\EspruinoProject\mai­nProgram.js");
    
    function onInit() {
     mainProgram(); // this would be a function in mainProgram.js
    }
    
    

    The only thing the javascript files have are something like:

    
    // mainProgram.js
    
    function mainProgram() {
       ... do stuff
    }
    
    

    No exports or anything. A browser also has the <script type="text/javascript" src="mainProgram.js"></script> tags with the links to javascript files. I think it would be great for organizing bigger projects on the espruino!

    From my understanding, the require function in espruino only gets modules from the SD card and is used to lazyload modules when needed. If that's not correct and it already does what I'm describing... then I'm and idiot and I'm sorry :)

    Regards,

    Alex

About

Avatar for Alex @Alex started