qp

q-parallel

q-parallel is base on q library, configurable max times at the same time of concurrent execute functions, support asynchronous functions

Showing:

Popularity

Downloads/wk

2

GitHub Stars

0

Maintenance

Last Commit

4yrs ago

Contributors

1

Package

Dependencies

1

Size (min+gzip)

4.9KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Feature q-parallel is base on q library, configurable max times at the same time of concurrent execute functions, support asynchronous functions Install

npm install q-parallel

Test

mocha

or

npm test

Usage

var p = require("q-parallel");
p(items, max, func, onFinish);
  • item : array of data or just repeat times
  • max: max times of function running at one time
  • func: function you want to execute, in the function should call defer.resolve({index: index, value : value});
  • onFinish: finish repeat the array and all results are return

Example

equire("q-parallel")([5,4,3,2,1], 2, function(index, defer, item){
    setTimeout(function(){
        defer.resolve({
            index : index,
            value : {item : item, index : index}
        });
    }, item * 1000);
}, function onFinish(result){
    console.log(result);
})

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100