vow-queue

WebJar for vow-queue

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

vow-queue
Последняя версия

Последняя версия

0.4.3
Дата

Дата

Тип

Тип

jar
Описание

Описание

vow-queue
WebJar for vow-queue
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/dfilatov/vow-queue

Скачать vow-queue

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/vow-queue/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>vow-queue</artifactId>
    <version>0.4.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/vow-queue/
implementation 'org.webjars.npm:vow-queue:0.4.3'
// https://jarcasting.com/artifacts/org.webjars.npm/vow-queue/
implementation ("org.webjars.npm:vow-queue:0.4.3")
'org.webjars.npm:vow-queue:jar:0.4.3'
<dependency org="org.webjars.npm" name="vow-queue" rev="0.4.3">
  <artifact name="vow-queue" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='vow-queue', version='0.4.3')
)
libraryDependencies += "org.webjars.npm" % "vow-queue" % "0.4.3"
[org.webjars.npm/vow-queue "0.4.3"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.npm : vow jar [0.4.17,0.5)

Модули Проекта

Данный проект не имеет модулей.

vow-queue

NPM Version Build Status

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

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

Версии библиотеки

Версия
0.4.3
0.4.1