# vow-queue

> Vow-based task queue

Latest version **0.4.3** (published 2017-10-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install vow-queue
pnpm add vow-queue
yarn add vow-queue
bun add vow-queue
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.3 |
| Published | 2017-10-04 |
| First published | 2013-07-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Dmitry Filatov |
| Maintainers | dfilatov |

## Links

- npm: https://www.npmjs.com/package/vow-queue
- Repository: https://github.com/dfilatov/vow-queue
- Homepage: https://github.com/dfilatov/vow-queue#readme
- Issues: https://github.com/dfilatov/vow-queue/issues
- npm.io page: https://npm.io/package/vow-queue

## Dependencies (1)

- [vow](https://npm.io/package/vow.md) ^0.4.17

## Recent versions

- 0.4.3 (latest) — 2017-10-04
- 0.4.2 — 2015-05-28
- 0.4.1 — 2014-10-20
- 0.4.0 — 2014-10-09
- 0.3.1 — 2014-06-06
- 0.3.0 — 2014-03-27
- 0.2.1 — 2014-02-10
- 0.2.0 — 2014-01-03
- 0.1.0 — 2013-12-23
- 0.0.2 — 2013-07-05
- 0.0.1 — 2013-07-04

## README

vow-queue [![NPM version](https://badge.fury.io/js/vow-queue.png)](http://badge.fury.io/js/vow-queue) [![Build Status](https://secure.travis-ci.org/dfilatov/vow-queue.png)](http://travis-ci.org/dfilatov/vow-queue)
===============

vow-queue is a module for task queue with weights and priorities

Installation
------------

Module can be installed using `npm`:

```
npm install vow-queue
```

or `bower`:

```
bower install vow-queue
```

Usage
-----

````javascript
var Queue = require('vow-queue'),
    queue = new Queue({ weightLimit : 10 });
    
queue.enqueue(function() { // simple function
    return 2 * 2;
});

queue.enqueue(function() { // function returns a promise
    // do job
    return promise;
});

queue.enqueue( // task with custom priority and weight
    function() {
        // do job
    },
    {
        priority : 3, // this task will be started before the previous two
        weight   : 5
    });
    
queue.start(); // starts tasks processing

queue.enqueue(function() { }); // and enqueue yet another task
````

API
-----
### Creating queue
####new Queue([params])
  * `params.weightLimit=100` limit of summary tasks weight which can be processed concurrently

### Methods of queue
####Promise enqueue(taskFn, [taskParams])
Enqueue given task in queue
  * `taskFn` task function which can return either a promise or a value
  * `taskParams.weight=1` weight of given task
  * `taskParams.priority=1` priority of given task

Returns promise which will be resolved when given task is done

####void start()
Starts processing of tasks in queue

####void stop()
Stops processing of tasks in queue

####Boolean isStarted()
Returns whether processing is started

####void setParams(params)
Sets queue params
* `params.weightLimit=100` limit of summary tasks weight which can be processed concurrently

####Object getStats()
Returns statistics about queue

---
_Source: https://npm.io/package/vow-queue · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
