In fact I think even prefixing your module with var module=this; will work.
watch out, the this inside a module is the exports itself, not the module ... I know it's quite confusing but better knowing this before doing any work.
console.log(this === module.exports);
If you require a file like that, the log is true in (node|io).js
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.
watch out, the
this
inside a module is theexports
itself, not the module ... I know it's quite confusing but better knowing this before doing any work.If you require a file like that, the log is
true
in (node|io).js