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>
|
</script>
|
||||||
<h1>Ox.doc - A JavaScript Documentation Language</h1>
|
<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>
|
<p>foo bar</p>
|
||||||
|
|
||||||
<pre class="code" id="foo">//@ My.TYPES <number> Request timeout, in seconds
|
<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
|
timeout <n|60> Timeout in seconds
|
||||||
type <s|'GET'> Request type ('GET', 'POST', 'PUT' or 'DELETE')
|
type <s|'GET'> Request type ('GET', 'POST', 'PUT' or 'DELETE')
|
||||||
callback <f> Callback function
|
callback <f> Callback function
|
||||||
result <o> Result object
|
result <o> Result object
|
||||||
status <n> HTTP status code
|
status <n> HTTP status code
|
||||||
data <s> Data read from URL, or empty string
|
data <s> Data read from URL, or empty string
|
||||||
@*/
|
@*/
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
Ox.Calendar <f:Ox.Element> Basic calendar object
|
Ox.Calendar <f:Ox.Element> Basic calendar object
|
||||||
() -> <f> Calendar object
|
() -> <o> Calendar object
|
||||||
(options) -> <f> Calendar object
|
(options) -> <o> Calendar object
|
||||||
(options, self) -> <f> Calendar object
|
(options, self) -> <o> Calendar object
|
||||||
options <o> Options object
|
options <o> Options object
|
||||||
date <d|new Date()> UTC Date on which the calendar is centered
|
date <d|new Date()> UTC Date on which the calendar is centered
|
||||||
events <[o]|[]> Event objects to be displayed
|
events <[o]|[]> Event objects to be displayed
|
||||||
|
|
|
@ -149,7 +149,7 @@ Ox.DocPage = function(options, self) {
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.append('<b>' + Ox.toTitleCase(section) + '</b>')
|
.append('<span class="OxSection">' + Ox.toTitleCase(section) + '</span>')
|
||||||
);
|
);
|
||||||
if (section == 'examples') {
|
if (section == 'examples') {
|
||||||
item.examples.forEach(function(example) {
|
item.examples.forEach(function(example) {
|
||||||
|
|
|
@ -103,11 +103,6 @@ Ox.TreeList = function(options, self) {
|
||||||
'symbol' + (data.expanded ? 'Down' : 'Right')
|
'symbol' + (data.expanded ? 'Down' : 'Right')
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.css({
|
|
||||||
width: '10px',
|
|
||||||
height: '10px',
|
|
||||||
padding: '3px'
|
|
||||||
})
|
|
||||||
)
|
)
|
||||||
.appendTo($item);
|
.appendTo($item);
|
||||||
}
|
}
|
||||||
|
@ -251,9 +246,11 @@ Ox.TreeList = function(options, self) {
|
||||||
|
|
||||||
self.setOption = function(key, value) {
|
self.setOption = function(key, value) {
|
||||||
if (key == 'data') {
|
if (key == 'data') {
|
||||||
|
// ...
|
||||||
|
} else if (key == 'selected') {
|
||||||
|
self.$list.options({selected: value});
|
||||||
} else if (key == 'width') {
|
} else if (key == 'width') {
|
||||||
|
// ...
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
'use strict';
|
'use strict';
|
||||||
/*@
|
/*@
|
||||||
Ox.SplitPanel <o:Ox.Element> SpliPanel Object
|
Ox.SplitPanel <f:Ox.Element> SpliPanel Object
|
||||||
() -> <f> SpliPanel Object
|
() -> <o> SpliPanel Object
|
||||||
(options) -> <f> SpliPanel Object
|
(options) -> <o> SpliPanel Object
|
||||||
(options, self) -> <f> SpliPanel Object
|
(options, self) -> <o> SpliPanel Object
|
||||||
options <o> Options object
|
options <o> Options object
|
||||||
elements <[o]|[]> Array of two or three element objects
|
elements <[o]|[]> Array of two or three element objects
|
||||||
collapsible <b|false> If true, can be collapsed (if outer element)
|
collapsible <b|false> If true, can be collapsed (if outer element)
|
||||||
|
@ -174,6 +174,18 @@ Ox.SplitPanel = function(options, self) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*@
|
||||||
|
getSize <f> get size of panel
|
||||||
|
(id) -> <i> id or position of panel, returns size
|
||||||
|
id <s|i> The element's id or position
|
||||||
|
@*/
|
||||||
|
// fixme: what is this? there is that.size()
|
||||||
|
that.getSize = function(id) {
|
||||||
|
var pos = Ox.isNumber(id) ? id : getPositionById(id),
|
||||||
|
element = self.options.elements[pos];
|
||||||
|
return element.element[self.dimensions[0]]() * !that.isCollapsed(pos);
|
||||||
|
};
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
isCollapsed <f> panel collapsed state
|
isCollapsed <f> panel collapsed state
|
||||||
(id) -> <b> id or position of panel, returns collapsed state
|
(id) -> <b> id or position of panel, returns collapsed state
|
||||||
|
@ -266,18 +278,6 @@ Ox.SplitPanel = function(options, self) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*@
|
|
||||||
getSize <f> get size of panel
|
|
||||||
(id) -> <i> id or position of panel, returns size
|
|
||||||
id <s|i> The element's id or position
|
|
||||||
@*/
|
|
||||||
// fixme: what is this? there is that.size()
|
|
||||||
that.getSize = function(id) {
|
|
||||||
var pos = Ox.isNumber(id) ? id : getPositionById(id),
|
|
||||||
element = self.options.elements[pos];
|
|
||||||
return element.element[self.dimensions[0]]() * !that.isCollapsed(pos);
|
|
||||||
};
|
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
toggle <f> Toggles collapsed state of an outer element
|
toggle <f> Toggles collapsed state of an outer element
|
||||||
(id) -> <o> The SplitPanel
|
(id) -> <o> The SplitPanel
|
||||||
|
|
|
@ -1,5 +1,20 @@
|
||||||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
|
|
||||||
|
/*@
|
||||||
|
Ox.TabPanel <f> Tabbed panel
|
||||||
|
(options) -> <o> Panel
|
||||||
|
(options, self) -> <o> Panel
|
||||||
|
options <o> Options
|
||||||
|
content <o|f> Content per tab
|
||||||
|
Either <code>({id1: $element1, id2: $element2}}</code> or
|
||||||
|
<code>function(id) { return $element; })</code>
|
||||||
|
size <n|24> Height of the tab bar
|
||||||
|
tabs [o] Tabs
|
||||||
|
id <s> Tab id
|
||||||
|
title <s> Tab title
|
||||||
|
self <o> Shared private variable
|
||||||
|
@*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
Ox.TabPanel = function(options, self) {
|
Ox.TabPanel = function(options, self) {
|
||||||
|
|
|
@ -597,6 +597,8 @@ Ox.some <f> Tests if one or more elements of a collection satisfy a given condit
|
||||||
true
|
true
|
||||||
> Ox.some("foo", function(v) { return v == 'f'; })
|
> Ox.some("foo", function(v) { return v == 'f'; })
|
||||||
true
|
true
|
||||||
|
> Ox.some([false, 0, null, '', void 0])
|
||||||
|
false
|
||||||
@*/
|
@*/
|
||||||
Ox.some = function(obj, fn) {
|
Ox.some = function(obj, fn) {
|
||||||
return Ox.filter(Ox.values(obj), fn || function(v) {
|
return Ox.filter(Ox.values(obj), fn || function(v) {
|
||||||
|
|
|
@ -34,8 +34,8 @@ Ox.doc <f> Generates documentation for annotated JavaScript
|
||||||
|
|
||||||
(source) <a> Array of documentation objects
|
(source) <a> Array of documentation objects
|
||||||
source <s> JavaScript source code
|
source <s> JavaScript source code
|
||||||
# > Ox.doc("//@ Ox.foo <string> just some string")
|
> Ox.doc("//@ My.FOO <n> Magic constant\nMy.FOO = 23;")
|
||||||
# [{"name": "Ox.foo", "summary": "just some string", "type": "string"}]
|
[{"name": "Ox.foo", "summary": "just some string", "type": "string"}]
|
||||||
@*/
|
@*/
|
||||||
|
|
||||||
Ox.doc = (function() {
|
Ox.doc = (function() {
|
||||||
|
|
Loading…
Reference in a new issue