forked from 0x2620/oxjs
misc. minor changes and documentation updates
This commit is contained in:
parent
92d4b032da
commit
abfea74565
8 changed files with 102 additions and 30 deletions
|
|
@ -38,6 +38,64 @@
|
|||
</script>
|
||||
<h1>Ox.doc - A JavaScript Documentation Language</h1>
|
||||
|
||||
<p>At its core, Ox.doc is list of lines like this:</p>
|
||||
<pre class="code">//@ name <type> summary</pre>
|
||||
<p>...</p>
|
||||
<pre class="code">/*@
|
||||
name <type> summary
|
||||
Longer description
|
||||
that may contain HTML.
|
||||
@*/
|
||||
</pre>
|
||||
|
||||
<p>If you are documenting an object with properties, these lines can be nested:</p>
|
||||
<pre class="code">/*@
|
||||
My.team <object> Some sports team
|
||||
name <string> The team's name
|
||||
lastMatch <object> The most recent result
|
||||
for <number> Goals for
|
||||
against <number> Goals against
|
||||
won <boolean> If true, last match was a win
|
||||
@*/</pre>
|
||||
|
||||
<p>The same goes for functions and events:</p>
|
||||
<pre class="code">/*@
|
||||
My.readURL <function> Reads data from a remote URL
|
||||
(url, callback) -> <o> Request handler
|
||||
cancel <function> The handler's only property. Takes no arguments. Cancels the request.
|
||||
url <string> Remote URL
|
||||
callback <function> Callback function
|
||||
result <object> Result object
|
||||
status <number> HTTP status code
|
||||
data <string> Data read from URL, or empty string
|
||||
stalled <event> Fires when the connection is stalled
|
||||
reason <string> Potential cause of the network problem
|
||||
@*/</pre>
|
||||
|
||||
|
||||
<p></p>
|
||||
|
||||
<pre class="code">/*@
|
||||
foo <o> Demo object
|
||||
array <a> An array (and we don't care about the type of its elements)
|
||||
boolean <b> True or false
|
||||
date <d> Date object
|
||||
element <e> DOM element
|
||||
function <f> A function
|
||||
number <n> A number
|
||||
object <o> An object
|
||||
regexp <r> Regular Expression
|
||||
string <s> A string
|
||||
undefined <u> undefined
|
||||
Makes most sense for the result of a function that doesn't return,
|
||||
or as the last of multiple types, to indicate a property may be missing
|
||||
any_value <*> anything
|
||||
event <!> A custom event
|
||||
example1 <[n]|u> An array of numbers, or undefined
|
||||
example2 <s|'foo'> A string, default 'foo'
|
||||
@*/
|
||||
</pre>
|
||||
|
||||
<p>foo bar</p>
|
||||
|
||||
<pre class="code" id="foo">//@ My.TYPES <number> Request timeout, in seconds
|
||||
|
|
@ -68,7 +126,7 @@ My.readURL <f> Reads data from a remote URL
|
|||
timeout <n|60> Timeout in seconds
|
||||
type <s|'GET'> Request type ('GET', 'POST', 'PUT' or 'DELETE')
|
||||
callback <f> Callback function
|
||||
result <o> Result object
|
||||
result <o> Result object
|
||||
status <n> HTTP status code
|
||||
data <s> Data read from URL, or empty string
|
||||
@*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue