• @Gordon, checked. It works - thanks for the nice Christmas gift...

    The corresponding export assignment is now:

    exports = MOD123;

    The module pattern of node.js and your modification implement now also a touch of require.js, which allows to give an application scoped name to a module (or class) to avoid name conflicts. Is require.js' protocol (or a part of it) on Espruino's radar?

    With require.js the application code for requiring multiple modules would then look like:

    require(['MOD123','OtherModule','OrOther­Class'],function(M123,OtherMod,OtherClas­s) {
        var myM123Instance = new M123();
        var myOtherModInst = new OtherMod();
        var myOtherClassInst = new OtherClass();
      });
    
About

Avatar for allObjects @allObjects started