summaryrefslogtreecommitdiff
path: root/lib/queue.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/queue.js')
-rw-r--r--lib/queue.js28
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/queue.js b/lib/queue.js
index ac1987a..109ba50 100644
--- a/lib/queue.js
+++ b/lib/queue.js
@@ -2,26 +2,27 @@ import queue from './internal/queue';
/**
* A queue of tasks for the worker function to complete.
- * @typedef {Object} queue
+ * @typedef {Object} QueueObject
+ * @memberOf module:ControlFlow
* @property {Function} length - a function returning the number of items
- * waiting to be processed. Invoke with ().
+ * waiting to be processed. Invoke with `queue.length()`.
* @property {Function} started - a function returning whether or not any
- * items have been pushed and processed by the queue. Invoke with ().
+ * items have been pushed and processed by the queue. Invoke with `queue.started()`.
* @property {Function} running - a function returning the number of items
- * currently being processed. Invoke with ().
+ * currently being processed. Invoke with `queue.running()`.
* @property {Function} workersList - a function returning the array of items
- * currently being processed. Invoke with ().
+ * currently being processed. Invoke with `queue.workersList()`.
* @property {Function} idle - a function returning false if there are items
- * waiting or being processed, or true if not. Invoke with ().
+ * waiting or being processed, or true if not. Invoke with `queue.idle()`.
* @property {number} concurrency - an integer for determining how many `worker`
* functions should be run in parallel. This property can be changed after a
* `queue` is created to alter the concurrency on-the-fly.
* @property {Function} push - add a new task to the `queue`. Calls `callback`
* once the `worker` has finished processing the task. Instead of a single task,
* a `tasks` array can be submitted. The respective callback is used for every
- * task in the list. Invoke with (task, [callback]),
+ * task in the list. Invoke with `queue.push(task, [callback])`,
* @property {Function} unshift - add a new task to the front of the `queue`.
- * Invoke with (task, [callback]).
+ * Invoke with `queue.unshift(task, [callback])`.
* @property {Function} saturated - a callback that is called when the number of
* running workers hits the `concurrency` limit, and further tasks will be
* queued.
@@ -39,11 +40,11 @@ import queue from './internal/queue';
* @property {boolean} paused - a boolean for determining whether the queue is
* in a paused state.
* @property {Function} pause - a function that pauses the processing of tasks
- * until `resume()` is called. Invoke with ().
+ * until `resume()` is called. Invoke with `queue.pause()`.
* @property {Function} resume - a function that resumes the processing of
- * queued tasks when the queue is paused. Invoke with ().
+ * queued tasks when the queue is paused. Invoke with `queue.length()`.
* @property {Function} kill - a function that removes the `drain` callback and
- * empties remaining tasks from the queue forcing it to go idle. Invoke with ().
+ * empties remaining tasks from the queue forcing it to go idle. Invoke with `queue.kill()`.
*/
/**
@@ -54,7 +55,8 @@ import queue from './internal/queue';
*
* @name queue
* @static
- * @memberOf async
+ * @memberOf module:ControlFlow
+ * @method
* @category Control Flow
* @param {Function} worker - An asynchronous function for processing a queued
* task, which must call its `callback(err)` argument when finished, with an
@@ -64,7 +66,7 @@ import queue from './internal/queue';
* @param {number} [concurrency=1] - An `integer` for determining how many
* `worker` functions should be run in parallel. If omitted, the concurrency
* defaults to `1`. If the concurrency is `0`, an error is thrown.
- * @returns {queue} A queue object to manage the tasks. Callbacks can
+ * @returns {module:ControlFlow.QueueObject} A queue object to manage the tasks. Callbacks can
* attached as certain properties to listen for specific events during the
* lifecycle of the queue.
* @example