// the module
module.exports = function () {
console.log('I am the module');
};
// the consumer
var module = require('my-module');
module(); // I am the module
With current Espruino there's no way to directly export the object or the function, you can only attach properties to the exports variable.
Will this be improved to reflect common npm modules pattern or the module object won't ever be exposed?
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.
OK, I wrote it not so clear indeed ...
This is current/common status in
npm
With current Espruino there's no way to directly export the object or the function, you can only attach properties to the
exports
variable.Will this be improved to reflect common
npm
modules pattern or themodule
object won't ever be exposed?Thanks