Writing and Submitting Modules (or changes)

If you've developed some code to interface to a bit of hardware (for instance an LCD or some kind of module) it'd be great if you could make and submit a JavaScript module (library) that others can use with a command like require("libname").

To test out your module, we'd suggest that you copy it verbatim into the right-hand side of the Web IDE, with the line var exports={}; at the top, and at the bottom, where you use the module, write exports.myfunction() instead of require('MOD123').myfunction().

Check out some of the other modules for examples (some of these still don't follow this form though). There are some important points to note here, which will help make your module as efficient as possible.

To get your module's description formatted nicely you just need to write it in a slightly special way, called Markdown. See this link for examples of how to use it, and maybe look at the other modules in GitHub.

You'll probably also want to add this to the end of the file if your module has more than one function. This will scan the JavaScript file for exported functions and comments of the form /** ... */ - which will then be included as a reference for your module.

  Reference
  ---------

  * APPEND_JSDOC: MOD123.js

You can also add APPEND_USES so that if others Write Tutorials that say USES: MOD123 at the top, they will be listed on your module's page:

  Using
  -----

  * APPEND_USES: MOD123

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.