Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
aearly committed Jul 9, 2018
1 parent b286037 commit 7188253
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/queue.js
Expand Up @@ -3,7 +3,7 @@ import wrapAsync from './internal/wrapAsync';

/**
* A queue of tasks for the worker function to complete.
* @typedef {Object} QueueObject
* @typedef {Iterable} QueueObject
* @memberOf module:ControlFlow
* @property {Function} length - a function returning the number of items
* waiting to be processed. Invoke with `queue.length()`.
Expand Down Expand Up @@ -53,6 +53,18 @@ import wrapAsync from './internal/wrapAsync';
* @property {Function} kill - a function that removes the `drain` callback and
* empties remaining tasks from the queue forcing it to go idle. No more tasks
* should be pushed to the queue after calling this function. Invoke with `queue.kill()`.
*
* @example
* const q = aync.queue(worker, 2)
* q.push(item1)
* q.push(item2)
* q.push(item3)
* // queues are iterable, spread into an array to inspect
* const items = [...q] // [item1, item2, item3]
* // or use for of
* for (let item of q) {
* console.log(item)
* }
*/

/**
Expand Down

0 comments on commit 7188253

Please sign in to comment.