@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:
var myM123Instance = new M123();
var myOtherModInst = new OtherMod();
var myOtherClassInst = new OtherClass();
© Espruino, powered by microcosm.
Report a problem