@ivoglent/nqueue
Simple processing queue for nodejs
Last updated 2 years ago by ivoglent .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @ivoglent/nqueue 
SYNC missed versions from official npm registry.

nqueue

Simple processing queue for nodejs

Quick start

$ npm i --save @ivoglent/nqueue

Usage

Example code :

import {expect} from 'chai';
import 'mocha';
import {queue} from "../src/components/queue";
import {QueueItemInterface} from "../src/interfaces/queue.interface";
queue.setHander(
    {
        execute : function (item: QueueItemInterface): Promise<boolean> {
            return new Promise((resolve => {
                console.log('Test handler. Executing item:', item);
                resolve(true);
            }))
        }
    }
);
queue.start();
describe('Test internal queue', () => {
   it('Test enqueue', (done) => {
        queue.push([1,2,3,4,5,6,7,8,9,0]);
        queue.push([11,22,33,44]);
        for(let i = 0; i < 10; i++) {
            queue.push(i);
        }
        expect(queue.getItems().length).to.be.equal(0);
        done();
   });
});

Current Tags

  • 1.0.2                                ...           latest (2 years ago)

3 Versions

  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 3
Last Month 6
Dependencies (1)
Dev Dependencies (10)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |