{"name":"vow-queue","author":{"name":"Dmitry Filatov","email":"dfilatov@yandex-team.ru"},"description":"Vow-based task queue","version":"0.4.2","contributors":[{"name":"Dmitry Filatov","email":"dfilatov@yandex-team.ru"}],"engines":{"node":">= 0.8.0"},"main":"lib/queue","dependencies":{"vow":"~0.4.0"},"devDependencies":{"jshint":"2.1.3","mocha":"1.11.0","chai":"*","jscs":"1.0.0","istanbul":"0.1.39","mocha-istanbul":"*"},"scripts":{"test":"make validate","lint":"make lint","coverage":"make coverage","clean":"make clean"},"repository":{"type":"git","url":"http://github.com/dfilatov/vow-queue.git"},"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)\n===============\n\nvow-queue is a module for task queue with weights and priorities\n\nInstallation\n------------\n\nModule can be installed using `npm`:\n\n```\nnpm install vow-queue\n```\n\nor `bower`:\n\n```\nbower install vow-queue\n```\n\nUsage\n-----\n\n````javascript\nvar Queue = require('vow-queue'),\n    queue = new Queue({ weightLimit : 10 });\n    \nqueue.enqueue(function() { // simple function\n    return 2 * 2;\n});\n\nqueue.enqueue(function() { // function returns a promise\n    // do job\n    return promise;\n});\n\nqueue.enqueue( // task with custom priority and weight\n    function() {\n        // do job\n    },\n    {\n        priority : 3, // this task will be started before the previous two\n        weight   : 5\n    });\n    \nqueue.start(); // starts tasks processing\n\nqueue.enqueue(function() { }); // and enqueue yet another task\n````\n\nAPI\n-----\n### Creating queue\n####new Queue([params])\n  * `params.weightLimit=100` limit of summary tasks weight which can be processed concurrently\n\n### Methods of queue\n####Promise enqueue(taskFn, [taskParams])\nEnqueue given task in queue\n  * `taskFn` task function which can return either a promise or a value\n  * `taskParams.weight=1` weight of given task\n  * `taskParams.priority=1` priority of given task\n\nReturns promise which will be resolved when given task is done\n\n####void start()\nStarts processing of tasks in queue\n\n####void stop()\nStops processing of tasks in queue\n\n####Boolean isStarted()\nReturns whether processing is started\n\n####void setParams(params)\nSets queue params\n* `params.weightLimit=100` limit of summary tasks weight which can be processed concurrently\n\n####Object getStats()\nReturns statistics about queue\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/dfilatov/vow-queue/issues"},"homepage":"https://github.com/dfilatov/vow-queue","_id":"vow-queue@0.4.2","_shasum":"e7fe17160e15c7c4184d1b666a9bc64e18e30184","_from":"https://registry.npmjs.org/vow-queue/-/vow-queue-0.4.2.tgz","_resolved":"https://registry.npmjs.org/vow-queue/-/vow-queue-0.4.2.tgz"}