diff options
-rw-r--r-- | docs/v3/docs.html | 1297 |
1 files changed, 1296 insertions, 1 deletions
diff --git a/docs/v3/docs.html b/docs/v3/docs.html index b14f668..6908a23 100644 --- a/docs/v3/docs.html +++ b/docs/v3/docs.html @@ -17168,4 +17168,1299 @@ callback, and must be synchronous.</p></td> <h5>Returns:</h5> - </article></section></div></div></body>
\ No newline at end of file + +<div class="param-desc"> + <p>a memoized version of <code>fn</code></p> +</div> + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type"><a href="global.html">AsyncFunction</a></span> + + + </dd> +</dl> + + + + + <h5>Example</h5> + + <pre class="prettyprint"><code>var slow_fn = function(name, callback) { + // do something + callback(null, result); +}; +var fn = async.memoize(slow_fn); + +// fn can now be used as if it were slow_fn +fn('some name', function() { + // callback +});</code></pre> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="memoize.js.html">memoize.js</a>, <a href="memoize.js.html#line5">line 5</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + <h4 class="name" id="nextTick"><span class="type-signature">(static) </span>nextTick<span class="signature">(callback)</span><span class="type-signature"></span></h4> + + + + + +<div class="description"> + <pre class="prettyprint source"><code>import nextTick from 'async/nextTick';</code></pre><p>Calls <code>callback</code> on a later loop around the event loop. In Node.js this just +calls <code>process.nextTick</code>. In the browser it will use <code>setImmediate</code> if +available, otherwise <code>setTimeout(callback, 0)</code>, which means other higher +priority events may precede the execution of <code>callback</code>.</p> +<p>This is used internally for browser-compatibility purposes.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>callback</code></td> + + + <td class="type"> + + +<span class="param-type">function</span> + + + + + + </td> + + + + <td class="description last"><p>The function to call on a later loop around +the event loop. Invoked with (args...).</p></td> + </tr> + + + + <tr> + + <td class="name"><code>args...</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + + + </td> + + + + <td class="description last"><p>any number of additional arguments to pass to the +callback on the next tick.</p></td> + </tr> + + + </tbody> +</table> + + + + + + + <h5>Example</h5> + + <pre class="prettyprint"><code>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);</code></pre> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="nextTick.js.html">nextTick.js</a>, <a href="nextTick.js.html#line5">line 5</a> + </li></ul></dd> + + + + + + <dt class="tag-see">See:</dt> + <dd class="tag-see"> + <ul> + <li><p><a href="#setImmediate">async.setImmediate</a></p></li> + </ul> + </dd> + + + +</dl> + + + + + + + + + + + + + + + + + + <h4 class="name" id="reflect"><span class="type-signature">(static) </span>reflect<span class="signature">(fn)</span><span class="type-signature"> → {function}</span></h4> + + + + + +<div class="description"> + <pre class="prettyprint source"><code>import reflect from 'async/reflect';</code></pre><p>Wraps the async function in another function that always completes with a +result object, even when it errors.</p> +<p>The result object has either the property <code>error</code> or <code>value</code>.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>fn</code></td> + + + <td class="type"> + + +<span class="param-type"><a href="global.html">AsyncFunction</a></span> + + + + + + </td> + + + + <td class="description last"><p>The async function you want to wrap</p></td> + </tr> + + + </tbody> +</table> + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <ul> +<li>A function that always passes null to it's callback as +the error. The second argument to the callback will be an <code>object</code> with +either an <code>error</code> or a <code>value</code> property.</li> +</ul> +</div> + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">function</span> + + + </dd> +</dl> + + + + + <h5>Example</h5> + + <pre class="prettyprint"><code>async.parallel([ + async.reflect(function(callback) { + // do some stuff ... + callback(null, 'one'); + }), + async.reflect(function(callback) { + // do some more stuff but error ... + callback('bad stuff happened'); + }), + async.reflect(function(callback) { + // do some more stuff ... + callback(null, 'two'); + }) +], +// optional callback +function(err, results) { + // values + // results[0].value = 'one' + // results[1].error = 'bad stuff happened' + // results[2].value = 'two' +});</code></pre> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="reflect.js.html">reflect.js</a>, <a href="reflect.js.html#line4">line 4</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + <h4 class="name" id="reflectAll"><span class="type-signature">(static) </span>reflectAll<span class="signature">(tasks)</span><span class="type-signature"> → {Array}</span></h4> + + + + + +<div class="description"> + <pre class="prettyprint source"><code>import reflectAll from 'async/reflectAll';</code></pre><p>A helper function that wraps an array or an object of functions with <code>reflect</code>.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>tasks</code></td> + + + <td class="type"> + + +<span class="param-type">Array</span> +| + +<span class="param-type">Object</span> +| + +<span class="param-type">Iterable</span> + + + + + + </td> + + + + <td class="description last"><p>The collection of +<a href="global.html">async functions</a> to wrap in <code>async.reflect</code>.</p></td> + </tr> + + + </tbody> +</table> + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <p>Returns an array of async functions, each wrapped in +<code>async.reflect</code></p> +</div> + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Array</span> + + + </dd> +</dl> + + + + + <h5>Example</h5> + + <pre class="prettyprint"><code>let tasks = [ + function(callback) { + setTimeout(function() { + callback(null, 'one'); + }, 200); + }, + function(callback) { + // do some more stuff but error ... + callback(new Error('bad stuff happened')); + }, + function(callback) { + setTimeout(function() { + callback(null, 'two'); + }, 100); + } +]; + +async.parallel(async.reflectAll(tasks), +// optional callback +function(err, results) { + // values + // results[0].value = 'one' + // results[1].error = Error('bad stuff happened') + // results[2].value = 'two' +}); + +// an example using an object instead of an array +let tasks = { + one: function(callback) { + setTimeout(function() { + callback(null, 'one'); + }, 200); + }, + two: function(callback) { + callback('two'); + }, + three: function(callback) { + setTimeout(function() { + callback(null, 'three'); + }, 100); + } +}; + +async.parallel(async.reflectAll(tasks), +// optional callback +function(err, results) { + // values + // results.one.value = 'one' + // results.two.error = 'two' + // results.three.value = 'three' +});</code></pre> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="reflectAll.js.html">reflectAll.js</a>, <a href="reflectAll.js.html#line3">line 3</a> + </li></ul></dd> + + + + + + <dt class="tag-see">See:</dt> + <dd class="tag-see"> + <ul> + <li><p><a href="#reflect">async.reflect</a></p></li> + </ul> + </dd> + + + +</dl> + + + + + + + + + + + + + + + + + + <h4 class="name" id="setImmediate"><span class="type-signature">(static) </span>setImmediate<span class="signature">(callback)</span><span class="type-signature"></span></h4> + + + + + +<div class="description"> + <pre class="prettyprint source"><code>import setImmediate from 'async/setImmediate';</code></pre><p>Calls <code>callback</code> on a later loop around the event loop. In Node.js this just +calls <code>setImmediate</code>. In the browser it will use <code>setImmediate</code> if +available, otherwise <code>setTimeout(callback, 0)</code>, which means other higher +priority events may precede the execution of <code>callback</code>.</p> +<p>This is used internally for browser-compatibility purposes.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>callback</code></td> + + + <td class="type"> + + +<span class="param-type">function</span> + + + + + + </td> + + + + <td class="description last"><p>The function to call on a later loop around +the event loop. Invoked with (args...).</p></td> + </tr> + + + + <tr> + + <td class="name"><code>args...</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + + + </td> + + + + <td class="description last"><p>any number of additional arguments to pass to the +callback on the next tick.</p></td> + </tr> + + + </tbody> +</table> + + + + + + + <h5>Example</h5> + + <pre class="prettyprint"><code>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);</code></pre> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="setImmediate.js.html">setImmediate.js</a>, <a href="setImmediate.js.html#line3">line 3</a> + </li></ul></dd> + + + + + + <dt class="tag-see">See:</dt> + <dd class="tag-see"> + <ul> + <li><p><a href="#nextTick">async.nextTick</a></p></li> + </ul> + </dd> + + + +</dl> + + + + + + + + + + + + + + + + + + <h4 class="name" id="timeout"><span class="type-signature">(static) </span>timeout<span class="signature">(asyncFn, milliseconds, info<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="global.html">AsyncFunction</a>}</span></h4> + + + + + +<div class="description"> + <pre class="prettyprint source"><code>import timeout from 'async/timeout';</code></pre><p>Sets a time limit on an asynchronous function. If the function does not call +its callback within the specified milliseconds, it will be called with a +timeout error. The code property for the error object will be <code>'ETIMEDOUT'</code>.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>asyncFn</code></td> + + + <td class="type"> + + +<span class="param-type"><a href="global.html">AsyncFunction</a></span> + + + + + + </td> + + + + <td class="description last"><p>The async function to limit in time.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>milliseconds</code></td> + + + <td class="type"> + + +<span class="param-type">number</span> + + + + + + </td> + + + + <td class="description last"><p>The specified time limit.</p></td> + </tr> + + + + <tr> + + <td class="name"><code>info</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + + + <span class="optional"><optional></span> + + </td> + + + + <td class="description last"><p>Any variable you want attached (<code>string</code>, <code>object</code>, etc) +to timeout Error for more information..</p></td> + </tr> + + + </tbody> +</table> + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <p>Returns a wrapped function that can be used with any +of the control flow functions. +Invoke this function with the same parameters as you would <code>asyncFunc</code>.</p> +</div> + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type"><a href="global.html">AsyncFunction</a></span> + + + </dd> +</dl> + + + + + <h5>Example</h5> + + <pre class="prettyprint"><code>function myFunction(foo, callback) { + doAsyncTask(foo, function(err, data) { + // handle errors + if (err) return callback(err); + + // do some stuff ... + + // return processed data + return callback(null, data); + }); +} + +var wrapped = async.timeout(myFunction, 1000); + +// call `wrapped` as you would `myFunction` +wrapped({ bar: 'bar' }, function(err, data) { + // if `myFunction` takes < 1000 ms to execute, `err` + // and `data` will have their expected values + + // else `err` will be an Error with the code 'ETIMEDOUT' +});</code></pre> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="timeout.js.html">timeout.js</a>, <a href="timeout.js.html#line4">line 4</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + <h4 class="name" id="unmemoize"><span class="type-signature">(static) </span>unmemoize<span class="signature">(fn)</span><span class="type-signature"> → {<a href="global.html">AsyncFunction</a>}</span></h4> + + + + + +<div class="description"> + <pre class="prettyprint source"><code>import unmemoize from 'async/unmemoize';</code></pre><p>Undoes a <a href="#memoize">memoize</a>d function, reverting it to the original, +unmemoized form. Handy for testing.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>fn</code></td> + + + <td class="type"> + + +<span class="param-type"><a href="global.html">AsyncFunction</a></span> + + + + + + </td> + + + + <td class="description last"><p>the memoized function</p></td> + </tr> + + + </tbody> +</table> + + + + +<h5>Returns:</h5> + + +<div class="param-desc"> + <p>a function that calls the original unmemoized function</p> +</div> + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type"><a href="global.html">AsyncFunction</a></span> + + + </dd> +</dl> + + + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="unmemoize.js.html">unmemoize.js</a>, <a href="unmemoize.js.html#line1">line 1</a> + </li></ul></dd> + + + + + + <dt class="tag-see">See:</dt> + <dd class="tag-see"> + <ul> + <li><p><a href="#memoize">async.memoize</a></p></li> + </ul> + </dd> + + + +</dl> + + + + + + + + + + + + + + + + + + +</article> + +</section> + + + + + <footer> + Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> using the Minami theme. +</footer></div> +</div> + +<nav id="toc"> + <h3>Methods:</h3><ul class="nav methods"><li class="toc-header"><a href="#collections">Collections</a></li><li data-type="method" class="toc-method"><a href="#concat">concat</a></li><li data-type="method" class="toc-method"><a href="#concatLimit">concatLimit</a></li><li data-type="method" class="toc-method"><a href="#concatSeries">concatSeries</a></li><li data-type="method" class="toc-method"><a href="#detect">detect</a></li><li data-type="method" class="toc-method"><a href="#detectLimit">detectLimit</a></li><li data-type="method" class="toc-method"><a href="#detectSeries">detectSeries</a></li><li data-type="method" class="toc-method"><a href="#each">each</a></li><li data-type="method" class="toc-method"><a href="#eachLimit">eachLimit</a></li><li data-type="method" class="toc-method"><a href="#eachOf">eachOf</a></li><li data-type="method" class="toc-method"><a href="#eachOfLimit">eachOfLimit</a></li><li data-type="method" class="toc-method"><a href="#eachOfSeries">eachOfSeries</a></li><li data-type="method" class="toc-method"><a href="#eachSeries">eachSeries</a></li><li data-type="method" class="toc-method"><a href="#every">every</a></li><li data-type="method" class="toc-method"><a href="#everyLimit">everyLimit</a></li><li data-type="method" class="toc-method"><a href="#everySeries">everySeries</a></li><li data-type="method" class="toc-method"><a href="#filter">filter</a></li><li data-type="method" class="toc-method"><a href="#filterLimit">filterLimit</a></li><li data-type="method" class="toc-method"><a href="#filterSeries">filterSeries</a></li><li data-type="method" class="toc-method"><a href="#groupBy">groupBy</a></li><li data-type="method" class="toc-method"><a href="#groupByLimit">groupByLimit</a></li><li data-type="method" class="toc-method"><a href="#groupBySeries">groupBySeries</a></li><li data-type="method" class="toc-method"><a href="#map">map</a></li><li data-type="method" class="toc-method"><a href="#mapLimit">mapLimit</a></li><li data-type="method" class="toc-method"><a href="#mapSeries">mapSeries</a></li><li data-type="method" class="toc-method"><a href="#mapValues">mapValues</a></li><li data-type="method" class="toc-method"><a href="#mapValuesLimit">mapValuesLimit</a></li><li data-type="method" class="toc-method"><a href="#mapValuesSeries">mapValuesSeries</a></li><li data-type="method" class="toc-method"><a href="#reduce">reduce</a></li><li data-type="method" class="toc-method"><a href="#reduceRight">reduceRight</a></li><li data-type="method" class="toc-method"><a href="#reject">reject</a></li><li data-type="method" class="toc-method"><a href="#rejectLimit">rejectLimit</a></li><li data-type="method" class="toc-method"><a href="#rejectSeries">rejectSeries</a></li><li data-type="method" class="toc-method"><a href="#some">some</a></li><li data-type="method" class="toc-method"><a href="#someLimit">someLimit</a></li><li data-type="method" class="toc-method"><a href="#someSeries">someSeries</a></li><li data-type="method" class="toc-method"><a href="#sortBy">sortBy</a></li><li data-type="method" class="toc-method"><a href="#transform">transform</a></li><li class="toc-header"><a href="#controlflow">Control Flow</a></li><li data-type="method" class="toc-method"><a href="#applyEach">applyEach</a></li><li data-type="method" class="toc-method"><a href="#applyEachSeries">applyEachSeries</a></li><li data-type="method" class="toc-method"><a href="#auto">auto</a></li><li data-type="method" class="toc-method"><a href="#autoInject">autoInject</a></li><li data-type="method" class="toc-method"><a href="#cargo">cargo</a></li><li data-type="method" class="toc-method"><a href="#cargoQueue">cargoQueue</a></li><li data-type="method" class="toc-method"><a href="#compose">compose</a></li><li data-type="method" class="toc-method"><a href="#doUntil">doUntil</a></li><li data-type="method" class="toc-method"><a href="#doWhilst">doWhilst</a></li><li data-type="method" class="toc-method"><a href="#forever">forever</a></li><li data-type="method" class="toc-method"><a href="#parallel">parallel</a></li><li data-type="method" class="toc-method"><a href="#parallelLimit">parallelLimit</a></li><li data-type="method" class="toc-method"><a href="#priorityQueue">priorityQueue</a></li><li data-type="method" class="toc-method"><a href="#queue">queue</a></li><li data-type="method" class="toc-method"><a href="#race">race</a></li><li data-type="method" class="toc-method"><a href="#retry">retry</a></li><li data-type="method" class="toc-method"><a href="#retryable">retryable</a></li><li data-type="method" class="toc-method"><a href="#seq">seq</a></li><li data-type="method" class="toc-method"><a href="#series">series</a></li><li data-type="method" class="toc-method"><a href="#times">times</a></li><li data-type="method" class="toc-method"><a href="#timesLimit">timesLimit</a></li><li data-type="method" class="toc-method"><a href="#timesSeries">timesSeries</a></li><li data-type="method" class="toc-method"><a href="#tryEach">tryEach</a></li><li data-type="method" class="toc-method"><a href="#until">until</a></li><li data-type="method" class="toc-method"><a href="#waterfall">waterfall</a></li><li data-type="method" class="toc-method"><a href="#whilst">whilst</a></li><li class="toc-header"><a href="#utils">Utils</a></li><li data-type="method" class="toc-method"><a href="#apply">apply</a></li><li data-type="method" class="toc-method"><a href="#asyncify">asyncify</a></li><li data-type="method" class="toc-method"><a href="#constant">constant</a></li><li data-type="method" class="toc-method"><a href="#dir">dir</a></li><li data-type="method" class="toc-method"><a href="#ensureAsync">ensureAsync</a></li><li data-type="method" class="toc-method"><a href="#log">log</a></li><li data-type="method" class="toc-method"><a href="#memoize">memoize</a></li><li data-type="method" class="toc-method"><a href="#nextTick">nextTick</a></li><li data-type="method" class="toc-method"><a href="#reflect">reflect</a></li><li data-type="method" class="toc-method"><a href="#reflectAll">reflectAll</a></li><li data-type="method" class="toc-method"><a href="#setImmediate">setImmediate</a></li><li data-type="method" class="toc-method"><a href="#timeout">timeout</a></li><li data-type="method" class="toc-method"><a href="#unmemoize">unmemoize</a></li></ul><h3>Methods:</h3> +</nav> + +<br class="clear"> + + + + +<script src="https://cdn.jsdelivr.net/prettify/0.1/prettify.js"></script> + +<script src="https://cdn.jsdelivr.net/jquery/2.2.4/jquery.min.js"></script> +<script src="https://cdn.jsdelivr.net/bootstrap/3.3.6/js/bootstrap.min.js"></script> +<script src="https://cdn.jsdelivr.net/typeahead.js/0.11.1/typeahead.bundle.min.js"></script> +<script>prettyPrint();</script> +<script src="scripts/async.js"></script> + +<script src="scripts/linenumber.js" async></script> +<script src="scripts/jsdoc-custom.js" async></script> +</body>
\ No newline at end of file |