• @Robin, in the Espruino IDE config you can define what should be loaded when using require(). Is that what you are looking for? ...after all, even a plain .js module file may minified... so you do not have fully control over it.

  • Sun 2021.10.31

    Thank you for responding @allObjects.

    Maybe my question should be where is the underlying Http/Wifi Javascript source (or any internal module) and it's corresponding minified resultant code block that is returned to the WebIDE when viewed using dump()?

    In comparrison,

    Should I load the 'GPS' module that is available as two sources:

    http://www.espruino.com/modules/GPS.js
    http://www.espruino.com/modules/GPS.min.js

    the WebIDE will (based on settings) fetch the .min.js file first, which when exposed using a browser will show the underlying content when using dump().

    var gps = require("GPS");
    Serial2.setup(9600,{tx:A2,rx:A3});
     gps = gps.connect(Serial2, function(data) {
     console.log(data);
    })
    



    and when viewed using dump()

    var gps = {
      "line": "",
      "#online": function (a) {
      var c;if(c="GGA"==a.substr(3,3)){c=a.length;var d=0;for(let e=1;e<c-3;e++)d^=a.charCodeAt(e);c=parseInt(a.substr(c-2),16)===d}c&&(a=a.split(","),c=a[2].indexOf("."),d=a[4].indexOf("."),f({time:a[1].substr(0,2)+":"+a[1].substr(2,2)+":"+a[1].substr(4,2),lat:(parseInt(a[2].substr(0,c-2),10)+parseFloat(a[2].substr(c-2))/60)*("S"==a[3]?-1:1),lon:(parseInt(a[4].substr(0,d-2),10)+parseFloat(a[4].substr(d-
    2))/60)*("W"==a[5]?-1:1),fix:parseInt(a[6],10),satellites:parseInt(a[7],10),altitude:parseFloat(a[9])}))
    }
    



    Comparing the two, it can be seen that function(a) is the same code that resides in the .min.js file in the online modules folder. The human readable corresponding .js file then, may be used to cross reference.



    How does one do the same task for the internal modules? (neopixel, wifi, http) etc.
    e.g. where is the human readable source and where/how does that become minified such that using dump() reveals the output as in post #1 ?

About

Avatar for allObjects @allObjects started