Documentation

include MVC MVC.Animate MVC.Class MVC.Controller MVC.Controller.Action MVC.Controller.Action.Drag MVC.Controller.Action.Drop MVC.Controller.Action.EnterLeave MVC.Controller.Action.Event MVC.Controller.Action.Hover MVC.Controller.Action.Lasso MVC.Controller.Action.Selectable MVC.Controller.Action.Subscribe MVC.Controller.Comet MVC.Controller.Params MVC.Controller.Params.Drag MVC.Controller.Params.Drop MVC.Controller.Stateful MVC.Delegator MVC.Doc MVC.Element MVC.Event MVC.File MVC.History MVC.IO MVC.IO.Ajax MVC.IO.Comet MVC.IO.JsonP MVC.IO.WindowName MVC.IO.XDoc MVC.Model MVC.Model.Ajax MVC.Model.Cookie MVC.Model.JsonP MVC.Model.JsonRest MVC.Model.WindowName MVC.Model.XmlRest MVC.Native MVC.Native.Array MVC.Native.Date MVC.Native.Function MVC.Native.Number MVC.Native.Object MVC.Native.String MVC.Options MVC.Store MVC.SyntheticEvent MVC.Test MVC.Test.Assertions MVC.Test.Controller MVC.Test.Functional MVC.Test.Runner MVC.Test.Unit MVC.Timer MVC.Timer.Easings MVC.Vector MVC.View MVC.View.Helpers OpenAjax

MVC.Doc

JavaScriptMVC comes with powerful and easy to extend documentation functionality - MVC Doc. MVC Doc is designed specifically for documenting JavaScript. It understands a little about JavaScript syntax to guess at things like function names and parameters. But, you can also document complex functionality across multiple files.


MVC Doc is pure JavaScript so it is easy to modify and make improvements. First, lets show what MVC Doc can document:

You can also specifify the scope of where your functions and attributes are being added with:

  • @prototype - add to the previous class or constructor's prototype functions
  • @static - add to the previous class or constructor's static functions
  • @add - add docs to a class or construtor described in another file

Finally, you have directives that provide addtional info about the comment:

Example

The following documents a Person constructor.
 /* @constructor
  * Person represents a human with a name.  Read about the 
  * animal class [Animal | here].
  * @init 
  * You must pass in a name.
  * @params {String} name A person's name
  *|
 Person = function(name){
    this.name = name
    Person.count ++;
 }
 /* @Static *|
 MVC.Object.extend(Person, {
    /* Number of People *|
    count: 0
 })
 /* @Prototype *|
 Person.prototype = {
   /* Returns a formal name 
    * @return {String} the name with "Mrs." added
    *|
   fancy_name : function(){
      return "Mrs. "+this.name;
   }
 }
There are a few things to notice:
  • The example closes comments with *|. You should close them with / instead of |.
  • We create a link to another class with [Animal | here].


Using with a JavaScritpMVC application

By default, compression will automatically document your code. Simply compress your application with:
js apps/app_name/compress.js
The docs will be put in your docs folder.

Using without JavaScriptMVC

This process will be made easier in the future. But you have to create a js file using application that looks like this:
 //loads doc source
 load('jmvc/rhino/documentation/setup.js'); 
 //pass file locations, and a name to a new Doc.Application
 new MVC.Doc.Application(['file1.js','folder/file2.js'], "MyApp");

Static Methods

link(content) -> undefined
Will replace with a link to a class or function if appropriate.
{Object} -
link_content(content) -> undefined
Replaces content in brackets [] with a link to source.
{String} - Any text, usually a commment.

objects

A map of the full name of all the objects the application creates and the url to the documentation for them.