UNPKG

async-await-queue

Version:

async/await simple priority queues

765 lines (180 loc) 7.56 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: Queue</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: Queue</h1> <section> <header> <h2><span class="attribs"><span class="type-signature"></span></span>Queue<span class="signature">(_maxConcurrent, _minCycle)</span><span class="type-signature"></span></h2> </header> <article> <div class="container-overview"> <h4 class="name" id="Queue"><span class="type-signature"></span>new Queue<span class="signature">(_maxConcurrent, _minCycle)</span><span class="type-signature"></span></h4> <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>_maxConcurrent</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last">Number of tasks allowed to run simultaneously</td> </tr> <tr> <td class="name"><code>_minCycle</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last">Minimum number of milliseconds between two tasks</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="queue.js.html">queue.js</a>, <a href="queue.js.html#line7">line 7</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="end"><span class="type-signature"></span>end<span class="signature">(hash)</span><span class="type-signature"></span></h4> <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>hash</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">Unique hash identifying the task</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="queue.js.html">queue.js</a>, <a href="queue.js.html#line38">line 38</a> </li></ul></dd> </dl> <h4 class="name" id="flush"><span class="type-signature">(async) </span>flush<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="queue.js.html">queue.js</a>, <a href="queue.js.html#line100">line 100</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> returns when the queue is empty </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id="stat"><span class="type-signature"></span>stat<span class="signature">()</span><span class="type-signature"> &rarr; {object}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="queue.js.html">queue.js</a>, <a href="queue.js.html#line89">line 89</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> running, waiting, last </div> <dl> <dt> Type </dt> <dd> <span class="param-type">object</span> </dd> </dl> <h4 class="name" id="wait"><span class="type-signature">(async) </span>wait<span class="signature">(hash, priority)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <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>hash</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">Unique hash identifying the task</td> </tr> <tr> <td class="name"><code>priority</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="queue.js.html">queue.js</a>, <a href="queue.js.html#line55">line 55</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Resolved when the task is ready to run </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Queue.html">Queue</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a> on Thu Jun 04 2020 22:37:05 GMT+0200 (Central European Summer Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>