Browse files

update doc

  • Loading branch information...
1 parent e1db79f commit 8d51ffe2889580a9a4f03da67e13993c608fa4ac @cho45 committed Mar 21, 2012
Showing with 89 additions and 78 deletions.
  1. +31 −30 doc/Deferred.html
  2. +1 −0 doc/template/class.tmpl
  3. +27 −18 doc/template/doc.css
  4. +30 −30 jsdeferred.js
View
61 doc/Deferred.html
@@ -284,7 +284,7 @@
// or this is shothand of above.
var d = Deferred();</pre>
- <pre class="code prettyprint lang-js"> $.deferred.define();
+ <pre class="code prettyprint lang-js"> Deferred.define();
$.get("/hoge").next(function (data) {
alert(data);
@@ -469,7 +469,7 @@
<h1>Returns</h1>
<span class="type">Deferred</span>
- <span class="desc">next deferred</span>
+ <span class="desc">Next Deferred object</span>
</section>
@@ -619,7 +619,7 @@
<h1>Returns</h1>
<span class="type">Deferred</span>
- <span class="desc">next deferred</span>
+ <span class="desc">Next Deferred object</span>
</section>
@@ -698,7 +698,7 @@
</header>
<section class="description">
- default callback function
+ Default callback function
</section>
@@ -750,7 +750,7 @@
</header>
<section class="description">
- default errorback function
+ Default errorback function
</section>
@@ -786,7 +786,7 @@
</header>
<section class="description">
- default export methods
+ Default export methods
</section>
@@ -806,6 +806,7 @@
</footer>
</section>
+ </section>
@@ -839,7 +840,7 @@
</span>
</dt>
- <dd>function to call</dd>
+ <dd>Function to call</dd>
<dt>
<span class="name">args</span>
@@ -848,7 +849,7 @@
</span>
</dt>
- <dd>arguments passed to fun</dd>
+ <dd>Arguments passed to `fun`</dd>
</dl>
</section>
@@ -924,7 +925,7 @@
</span>
</dt>
- <dd>process chains</dd>
+ <dd>Process chains</dd>
</dl>
</section>
@@ -1018,7 +1019,7 @@
</span>
</dt>
- <dd>target function or object</dd>
+ <dd>Target function or object</dd>
<dt>
<span class="name">options</span>
@@ -1027,7 +1028,7 @@
</span>
</dt>
- <dd>options or method name of object in arguments[0]</dd>
+ <dd>Options or method name of object in arguments[0]</dd>
</dl>
</section>
@@ -1098,7 +1099,7 @@
</span>
</dt>
- <dd></dd>
+ <dd>A object which this method should export to</dd>
<dt>
<span class="name">list</span>
@@ -1107,7 +1108,7 @@
</span>
</dt>
- <dd>(default Deferred.methods)</dd>
+ <dd>List of function names (default Deferred.methods)</dd>
</dl>
</section>
@@ -1130,7 +1131,7 @@
</header>
<section class="description">
- export functions to obj.
+ Export functions to obj.
</section>
@@ -1167,7 +1168,7 @@
</span>
</dt>
- <dd>Deferreds wanted to wait</dd>
+ <dd>Deferred objects wanted to wait</dd>
</dl>
</section>
@@ -1237,7 +1238,7 @@
</span>
</dt>
- <dd>object to determine.</dd>
+ <dd>Object to determine</dd>
</dl>
</section>
@@ -1297,7 +1298,7 @@
</span>
</dt>
- <dd>loop definition</dd>
+ <dd>Loop count or definition object</dd>
<dt>
<span class="name">fun</span>
@@ -1306,7 +1307,7 @@
</span>
</dt>
- <dd>loop function</dd>
+ <dd>Loop function</dd>
</dl>
</section>
@@ -1322,7 +1323,7 @@
<h1>Returns</h1>
<span class="type">Deferred</span>
- <span class="desc"></span>
+ <span class="desc">Called when all loop was completed</span>
</section>
@@ -1381,7 +1382,7 @@
</span>
</dt>
- <dd>callback</dd>
+ <dd>Callback function</dd>
</dl>
</section>
@@ -1442,7 +1443,7 @@
</span>
</dt>
- <dd>Deferreds wanted to wait</dd>
+ <dd>Deferred objects wanted to wait</dd>
</dl>
</section>
@@ -1532,7 +1533,7 @@
</span>
</dt>
- <dd>name of method</dd>
+ <dd>Name of method</dd>
<dt>
<span class="name">fun</span>
@@ -1541,7 +1542,7 @@
</span>
</dt>
- <dd>actual function of method</dd>
+ <dd>Actual function of method</dd>
</dl>
</section>
@@ -1604,7 +1605,7 @@
</span>
</dt>
- <dd>loop count</dd>
+ <dd>Loop count</dd>
<dt>
<span class="name">fun</span>
@@ -1613,7 +1614,7 @@
</span>
</dt>
- <dd>loop function</dd>
+ <dd>Loop function</dd>
</dl>
</section>
@@ -1629,7 +1630,7 @@
<h1>Returns</h1>
<span class="type">Deferred</span>
- <span class="desc"></span>
+ <span class="desc">Called when all loop was completed</span>
</section>
@@ -1680,7 +1681,7 @@
</span>
</dt>
- <dd></dd>
+ <dd>Count number to retry</dd>
<dt>
<span class="name">funcDeferred</span>
@@ -1689,7 +1690,7 @@
</span>
</dt>
- <dd></dd>
+ <dd>A function returns Deferred</dd>
<dt>
<span class="name">options</span>
@@ -1698,7 +1699,7 @@
</span>
</dt>
- <dd></dd>
+ <dd>Options</dd>
</dl>
</section>
@@ -1768,7 +1769,7 @@
</span>
</dt>
- <dd>second to wait</dd>
+ <dd>Second to wait</dd>
</dl>
</section>
View
1 doc/template/class.tmpl
@@ -424,6 +424,7 @@
</footer>
</section>
</for>
+ </section>
</if>
<if test="defined(ownMethods) && ownMethods.length">
View
45 doc/template/doc.css
@@ -5,8 +5,10 @@ body {
line-height: 1.66;
padding: 1em 5em;
font-size: 14px;
- background: #fff;
+ background: #efefef;
color: #333;
+ width: 940px;
+ margin: 0 auto;
}
a:link {
@@ -50,7 +52,7 @@ pre {
}
h1 {
- margin: 10px 0 0;
+ margin: 20px 0 10px;
padding: 0;
}
@@ -61,7 +63,6 @@ section {
}
table {
- background: #fff;
color: #222;
width: 100%;
margin: 1em 0;
@@ -106,14 +107,8 @@ table td.description .type {
section.constructor ,
section.value ,
section.method {
- margin: 10px 0 20px ;
- padding: 10px 20px;
- background: #efefef;
- -moz-border-radius: 10px;
- -webkit-border-radius: 10px;
- -o-border-radius: 10px;
- -ms-border-radius: 10px;
- border-radius: 10px;
+ margin: 20px 0 20px ;
+ padding: 50px 0;
}
section.constructor h1 ,
@@ -122,8 +117,6 @@ section.method h1 {
font-size: 100%;
font-family: "Monaco", "Lucida Console", monospace;
padding: 0;
- background: #efefef;
- color: #000;
}
section.method h1 .attr {
@@ -169,7 +162,7 @@ section.constructor section h1 ,
section.value section h1 ,
section.method section h1 {
margin: 10px 0;
- color: #000;
+ padding: 0;
background: transparent;
font-weight: bold;
font-size: 100%;
@@ -182,31 +175,47 @@ section.method section dl {
section.method section dl dt {
font-family: "Monaco", "Lucida Console", monospace;
+ font-size: 90%;
}
section.method section.return .type {
font-family: "Monaco", "Lucida Console", monospace;
+ font-size: 90%;
}
section.method section.return .name {
font-family: "Monaco", "Lucida Console", monospace;
+ font-size: 90%;
+}
+
+section.value section.parameters ,
+section.value section.return ,
+section.method section.parameters ,
+section.method section.return {
+ padding: 0 0 0 10px;
+}
+
+section.value section.parameters h1 ,
+section.value section.return h1 ,
+section.method section.parameters h1 ,
+section.method section.return h1 {
+ font-family: 'Buenard', serif;
+ font-size: 110%;
+ padding: 10px 0 0;
+ margin: 0 0 10px -10px;
}
-section.parameters h1 ,
-section.return h1 ,
section.see h1 {
font-family: 'Buenard', serif;
font-size: 110% !important;
padding: 10px 0 0;
}
section.parameters dl dt .name {
- color: #000;
font-weight: bold;
}
section.return .type {
font-weight: bold;
margin: 0 1em 0 0;
- color: #000;
}
View
60 jsdeferred.js
@@ -41,7 +41,7 @@
* var d = Deferred();
*
* @example
- * $.deferred.define();
+ * Deferred.define();
*
* $.get("/hoge").next(function (data) {
* alert(data);
@@ -63,13 +63,13 @@
*/
function Deferred () { return (this instanceof Deferred) ? this.init() : new Deferred() }
/**
- * default callback function
+ * Default callback function
* @type {function(this:Deferred, ...[*]):*}
* @field
*/
Deferred.ok = function (x) { return x };
/**
- * default errorback function
+ * Default errorback function
* @type {function(this:Deferred, ...[*]):*}
* @field
*/
@@ -113,7 +113,7 @@ Deferred.prototype = {
* d.call();
*
* @param {function(this:Deferred, ...[*]):*} fun Callback of continuation.
- * @return {Deferred} next deferred
+ * @return {Deferred} Next Deferred object
*/
next : function (fun) { return this._post("ok", fun) },
@@ -141,7 +141,7 @@ Deferred.prototype = {
* d.call();
*
* @param {function(this:Deferred, ...[*]):*} fun Errorback of continuation.
- * @return {Deferred} next deferred
+ * @return {Deferred} Next Deferred object
*/
error : function (fun) { return this._post("ng", fun) },
@@ -219,7 +219,7 @@ Deferred.prototype = {
* Returns true if an argument is Deferred.
*
* @function
- * @param {*} obj object to determine.
+ * @param {*} obj Object to determine
* @return {boolean}
*/
Deferred.isDeferred = function (obj) {
@@ -232,7 +232,7 @@ Deferred.isDeferred = function (obj) {
*
* @function
* @name Deferred.next
- * @param {function():*} fun callback
+ * @param {function():*} fun Callback function
* @return {Deferred}
*/
Deferred.next_default = function (fun) {
@@ -341,7 +341,7 @@ Deferred.next =
* }
* );
*
- * @param {...[(Array.<function(*):*>|Object.<string,function(*):*>|function(*):*)]} arguments process chains
+ * @param {...[(Array.<function(*):*>|Object.<string,function(*):*>|function(*):*)]} arguments Process chains
* @return {Deferred}
*/
Deferred.chain = function () {
@@ -378,7 +378,7 @@ Deferred.chain = function () {
* log(elapsed); //=> may be 990-1100
* });
*
- * @param {number} sec second to wait
+ * @param {number} sec Second to wait
* @return {Deferred}
*/
Deferred.wait = function (n) {
@@ -410,8 +410,8 @@ Deferred.wait = function (n) {
* print([r, "end"]);
* });
*
- * @param {function(...[*]):*} fun function to call
- * @param {...*} args arguments passed to fun
+ * @param {function(...[*]):*} fun Function to call
+ * @param {...*} args Arguments passed to `fun`
* @return {Deferred}
*/
Deferred.call = function (fun) {
@@ -446,7 +446,7 @@ Deferred.call = function (fun) {
* values.bar //=> bar.html data
* });
*
- * @param {(Array.<Deferred>|Object.<string,Deferred>)} dl Deferreds wanted to wait
+ * @param {(Array.<Deferred>|Object.<string,Deferred>)} dl Deferred objects wanted to wait
* @return {Deferred}
* @see Deferred.earlier
*/
@@ -489,7 +489,7 @@ Deferred.parallel = function (dl) {
* Continue process when one deferred in `deferredlist` has completed. Others will be canceled.
* parallel ('and' processing) <=> earlier ('or' processing)
*
- * @param {(Array.<Deferred>|Object.<string,Deferred>)} dl Deferreds wanted to wait
+ * @param {(Array.<Deferred>|Object.<string,Deferred>)} dl Deferred objects wanted to wait
* @return {Deferred}
* @see Deferred.parallel
*/
@@ -547,9 +547,9 @@ Deferred.earlier = function (dl) {
* return wait(1);
* });
*
- * @param {(number|{begin:number, end:number, step:number})} n loop definition
- * @param {function(number):*} fun loop function
- * @return {Deferred}
+ * @param {(number|{begin:number, end:number, step:number})} n Loop count or definition object
+ * @param {function(number):*} fun Loop function
+ * @return {Deferred} Called when all loop was completed
*/
Deferred.loop = function (n, fun) {
var o = {
@@ -597,9 +597,9 @@ Deferred.loop = function (n, fun) {
* i //=> 0,1,2,3,4,5,6,7,8,9
* });
*
- * @param {number} n loop count
- * @param {function(number)} fun loop function
- * @return {Deferred}
+ * @param {number} n Loop count
+ * @param {function(number)} fun Loop function
+ * @return {Deferred} Called when all loop was completed
*/
Deferred.repeat = function (n, fun) {
var i = 0, end = {}, ret = null;
@@ -628,8 +628,8 @@ Deferred.repeat = function (n, fun) {
* print(n);
* });
*
- * @param {string} name name of method
- * @param {function(*):Deferred} fun actual function of method
+ * @param {string} name Name of method
+ * @param {function(*):Deferred} fun Actual function of method
*/
Deferred.register = function (name, fun) {
this.prototype[name] = function () {
@@ -658,8 +658,8 @@ Deferred.register("wait", Deferred.wait);
* alert('after 1 sec');
* });
*
- * @param {(function(...[*]):*|*)} funo target function or object
- * @param {({ok:number, ng:number, target:*}|string)} options options or method name of object in arguments[0]
+ * @param {(function(...[*]):*|*)} funo Target function or object
+ * @param {({ok:number, ng:number, target:*}|string)} options Options or method name of object in arguments[0]
* @return {function(...[*]):Deferred}
*/
Deferred.connect = function (funo, options) {
@@ -724,9 +724,9 @@ Deferred.Arguments = function (args) { this.args = Array.prototype.slice.call(ar
* e //=> error if all try failed
* });
*
- * @param {number} retryCount
- * @param {function(number):Deferred} funcDeferred
- * @param {{wait:number}} options
+ * @param {number} retryCount Count number to retry
+ * @param {function(number):Deferred} funcDeferred A function returns Deferred
+ * @param {{wait:number}} options Options
* @return {Deferred}
*/
Deferred.retry = function (retryCount, funcDeferred, options) {
@@ -753,15 +753,15 @@ Deferred.retry = function (retryCount, funcDeferred, options) {
};
/**
- * default export methods
+ * Default export methods
*
* @see Deferred.define
*/
Deferred.methods = ["parallel", "wait", "next", "call", "loop", "repeat", "chain"];
/**
- * export functions to obj.
- * @param {Object} obj
- * @param {Array.<string>=} list (default Deferred.methods)
+ * Export functions to obj.
+ * @param {Object} obj A object which this method should export to
+ * @param {Array.<string>=} list List of function names (default Deferred.methods)
* @return {function():Deferred} The Deferred constructor function
*/
Deferred.define = function (obj, list) {

0 comments on commit 8d51ffe

Please sign in to comment.