looks like mentioning modules in a generic way is a bit a mixed fruit salad...
Modules in the various contexts and processes how they came to be shows the different genuine fruit flavors... so to speak...
There are various types of modules: since we are in the JS world, they are visible in the JS context. Their guts and how they came to be varies a lot:
Some (all?) modules - even though built in- still need a require() to be issued to get them into the application accessible context, because loading / intialization / creation of runtime objects has to happen before the modules functions / objects can be used. Some modules are purely SW related and provide processing services / functions, some they provide access and handling of internal hardware, and thru latter also access and handling of externally wired/connected hardware, such as sensors, etc, often also called modules - hardware modules (they may contain software/firmware as well - as any decently intelligent sensor or communication 'device'/module does - but that's not of concern in this context).
The implementation of the require() and the uploader looking for these (nested) requires (and knowledge ab about what the firmware includes decide what to upload. No minification happens on upload of modules... they are dumped the way they are known to the Modules cache. For the application code in the Espruino IDE editor (right side), the IDE can be configured whether to run the code thru a/the minifier or not.
Speaking of objects: everything is (kind) an object - hence allObects ;_), even though some feel more like functions, where others seem to be just data, and some that are actually fully fletched with data and function (state and behavior). Objects can exist as singletons or - with availability of a generally available constructor(s) - as many instances one type or class - or prototype (to be JS specific).
PS: @Robin, I guess I'm not providing any new insight to you in this post... :\ ... (and it is already documented... may be not in a form to make it obvious 'in one page'... That's why I like the combination of Reference info, Forum, Tutorials, Youtube clips, Instructables... all looking at the same thing from various perspectives...).
© Espruino, powered by microcosm.
Report a problem