summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHubert Argasinski <argasinski.hubert@gmail.com>2016-04-12 01:50:38 -0700
committerGraeme Yeates <yeatesgraeme@gmail.com>2016-04-12 18:46:35 -0400
commit6ed5305d0f954b7b10bd8d67d62c70c4cc487443 (patch)
tree0436ec1c13808e3454920ba26cd0176679462ffa
parent385c0550d0822b49e2205bdfffa24106c7ef4c64 (diff)
downloadasync-6ed5305d0f954b7b10bd8d67d62c70c4cc487443.tar.gz
jsdoc-style documentation final touches
added module documentation to index.js and documentated missed method setImmediate (copied from nextTick).
-rw-r--r--lib/index.js7
-rw-r--r--lib/setImmediate.js30
2 files changed, 37 insertions, 0 deletions
diff --git a/lib/index.js b/lib/index.js
index 6832662..1f41361 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -1,5 +1,12 @@
'use strict';
+/**
+ * Async is a utility module which provides straight-forward, powerful functions
+ * for working with asynchronous JavaScript. Although originally designed for
+ * use with [Node.js](http://nodejs.org) and installable via
+ * `npm install --save async`, it can also be used directly in the browser.
+ * @module async
+ */
import applyEach from './applyEach';
import applyEachSeries from './applyEachSeries';
import apply from './apply';
diff --git a/lib/setImmediate.js b/lib/setImmediate.js
index 05d9555..8bd57c3 100644
--- a/lib/setImmediate.js
+++ b/lib/setImmediate.js
@@ -2,4 +2,34 @@
import setImmediate from './internal/setImmediate';
+/**
+ * Calls `callback` on a later loop around the event loop. In Node.js this just
+ * calls `setImmediate`. In the browser it will use `setImmediate` if
+ * available, otherwise `setTimeout(callback, 0)`, which means other higher
+ * priority events may precede the execution of `callback`.
+ *
+ * This is used internally for browser-compatibility purposes.
+ *
+ * @name setImmediate
+ * @static
+ * @memberOf async
+ * @alias nextTick
+ * @category Util
+ * @param {Function} callback - The function to call on a later loop around
+ * the event loop. Invoked with (args...).
+ * @param {...*} args... - any number of additional arguments to pass to the
+ * callback on the next tick.
+ * @example
+ *
+ * var call_order = [];
+ * async.nextTick(function() {
+ * call_order.push('two');
+ * // call_order now equals ['one','two']
+ * });
+ * call_order.push('one');
+ *
+ * async.setImmediate(function (a, b, c) {
+ * // a, b, and c equal 1, 2, and 3
+ * }, 1, 2, 3);
+ */
export default setImmediate;