1.0.1 • Published 6 years ago

async-bucket v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Async-Bucket

A minimal library for throttling async concurrency. Rewrited version of async-limiter.

Example

Copied from async-limiter.

var Limiter = require('async-bucket');

var t = new Limiter({concurrency: 2});
var results = [];

// add jobs using the familiar Array API
t.push(function (cb) {
  results.push('two');
  cb();
});

t.push(
  function (cb) {
    results.push('four');
    cb();
  },
  function (cb) {
    results.push('five');
    cb();
  }
);

t.unshift(function (cb) {
  results.push('one');
  cb();
});

t.splice(2, 0, function (cb) {
  results.push('three');
  cb();
});

// Jobs run automatically. If you want a callback when all are done,
// call 'onDone()'.
t.onDone(function () {
  console.log('all done:', results)
});
1.0.1

6 years ago

1.0.0

6 years ago