update oxdoc article

This commit is contained in:
rolux 2012-06-23 20:42:46 +02:00
parent 76722ec437
commit 8ab36de816

View file

@ -1,3 +1,53 @@
<h1>OxDoc - A JavaScript Documentation Language</h1> <h1>OxDoc - A JavaScript Documentation Language</h1>
<p>Nothing to see here yet, please move along...</p> <p>Nothing to see here yet, please move along...</p>
<pre class="code" id="doc">
//@ Section Name
My = {};
//@ My.foo &lt;number> One-line summary, with *some* `markdown`
My.foo = 23;
/*@
My.bar &lt;object> Summary
Optional multi-line description, with *some* `markdown`.
property &lt;object> A property of My.bar
Description
foo &lt;number> A number
bar &lt;[string]> An array of strings
method &lt;function> A method of My.bar
(foo[, bar], callback) -> &lt;undefined> Return value
foo &lt;number|string> Argument, number or string
bar &lt;boolean|false> Optional argument, default is `false`
callback &lt;function> Callback function
arg &lt;boolean> Argument
baz &lt;event> An event triggered by My.bar
x &lt;number> Event property
y &lt;number> Event property
# This is a comment. Below are inline tests (the first one will fail, the
# last one is asynchronous).
> My.bar.property.foo > 1
true
> My.bar.property.bar.join('')
'string'
> My.bar.method(1, function(arg) { Ox.test(arg, true); })
undefined
*/
My.bar = {
property: {
foo: Math.random(),
bar: 'string'.split('')
},
method: function(foo, bar, callback) {
if (arguments.length == 2) {
callback = bar;
bar = false;
}
if (bar) {
// trigger baz event
}
setTimeout(function() {
callback(!!foo);
});
}
};
</pre>