Ox.load: clean up documentation and properly document the optional first argument (pass true to switch from dev to build)
This commit is contained in:
parent
4d5291c340
commit
d660edbe2b
1 changed files with 33 additions and 12 deletions
|
@ -13,21 +13,42 @@ this.Ox = function(value) {
|
|||
};
|
||||
|
||||
/*@
|
||||
Ox.load <f> Loads one or more modules
|
||||
A module named "Foo" provides `Ox.Foo/Ox.Foo.js`, in which it defines one
|
||||
Ox.load <f> Loads OxJS and, optionally, one or more modules
|
||||
To load OxJS, include `/build/Ox.js` (minified version) or `/dev/Ox.js`
|
||||
(development version), and use `Ox.load(callback)` at the beginning of your
|
||||
program. The callback will run once OxJS is loaded and the document is
|
||||
ready. To choose the version programatically (for example: minified version
|
||||
on production server, development version on localhost), include the
|
||||
development version and pass `true` as a first parameter to `Ox.load` in
|
||||
case you want to switch to the minified version. To load one or more
|
||||
modules, either at the beginning or at a later point, use<br>
|
||||
<br>
|
||||
<ul><li>`Ox.load(module, callback)` (one module),</li>
|
||||
<li>`Ox.load(module, options, callback)` (one module with options),</li>
|
||||
<li>`Ox.load(['moduleA', 'moduleB', ...], callback)` (multiple modules)</li>
|
||||
<li>`Ox.load({moduleA: optionsA, moduleB: optionsB, ...}, callback)` (multiple
|
||||
modules with options) or either</li>
|
||||
<li>`Ox.load(['moduleA', {moduleB: optionsB}, ...], callback)` or
|
||||
`Ox.load({moduleA: {}, moduleB: optionsB, ...}, callback)` (multiple modules
|
||||
without and with options).</li></ul>
|
||||
<br>
|
||||
A module named 'Foo' provides `Ox.Foo/Ox.Foo.js`, in which it defines one
|
||||
method, `Ox.load.Foo`, that takes two arguments, `options` and `callback`,
|
||||
and calls `callback` with one argument, `true` for success or `false` if an
|
||||
error occurred. Generally, the module should define `Ox.Foo` and attach its
|
||||
error occurred. A third-party module should define `Ox.Foo` and attach its
|
||||
own methods there.
|
||||
(callback) -> <u> undefined
|
||||
(module, callback) -> <u> undefined
|
||||
(module, options, callback) -> <u> undefined
|
||||
(modules, callback) -> <u> undefined
|
||||
module <s> Module name
|
||||
options <o> Module options
|
||||
modules <a|o> Multiple modules
|
||||
Either `['moduleA', {moduleB: options}, ...]`
|
||||
or `{moduleA: {}, moduleB: options, ...}`
|
||||
([min ,]callback) -> <u> undefined
|
||||
([min ,]module, callback) -> <u> undefined
|
||||
([min ,]module, options, callback) -> <u> undefined
|
||||
([min ,]modules, callback) -> <u> undefined
|
||||
min <b> If true, switch from development version to minified version
|
||||
module <s> Module name
|
||||
options <o> Module options
|
||||
modules <a|o> Multiple modules
|
||||
`['moduleA', 'moduleB']` (without options) or
|
||||
`{moduleA: optionsA, moduleB: optionsB, ...}` (with options) or either
|
||||
`['moduleA', {moduleB: optionsB}, ...]` or
|
||||
`{moduleA: {}, moduleB: optionsB, ...}` (without and with options)
|
||||
callback <f> Callback function
|
||||
success <b> If true, all modules have been loaded successfully
|
||||
@*/
|
||||
|
|
Loading…
Reference in a new issue