@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','OrOtherClass'],function(M123,OtherMod,OtherClass) {
var myM123Instance = new M123();
var myOtherModInst = new OtherMod();
var myOtherClassInst = new OtherClass();
});
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@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: