You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • There's some info on making modules here: http://www.espruino.com/Writing+Modules

    It's for the website, but that way of working can go equally well when trying to build a module in.

    But yes, the main thing is anything you want to access directly should just be exports.xyz = ....

    One other thing to note: If you're trying to do arrays in a built-in module, try and do them inside a function where possible:

    exports.getMyArray = function() { return [....] }; stores the function text in flash until it's executes, but exports.myArray = [....]; will put the array in RAM as soon as you first call require(...) and will keep it there

About

Avatar for Gordon @Gordon started