Crazy Glue
Allows you to pull together multiple async calls together.
Usage
Basic
var CrazyGlue = require('crazy_glue');
var glue = new CrazyGlue(3);
glue.ok('1', 'hello');
glue.ok('2', 'world');
glue.ok('3', 'test');
glue.ok('3', 'test2');
glue.on('done', function(errors, results) {
});
results will be
{ 1: 'hello', 2: 'world', 3: ['test', 'test2'] }
errors will be
{ }
With errors
var CrazyGlue = require('crazy_glue');
var glue = new CrazyGlue(3);
glue.ok('1', 'hello');
glue.error('world', 'failed');
glue.error('test', 'failed');
glue.error('test', 'failed2');
glue.on('done', function(errors, results) {
});
results will be
{ 1: 'hello' }
errors will be
{ world: 'failed', test: ['failed', 'failed2']}
With stats
var CrazyGlue = require('crazy_glue');
var glue = new CrazyGlue(5);
glue.ok('1', 'hello');
glue.ok();
glue.error('world', 'failed');
glue.error('test', 'failed');
glue.error();
glue.on('done', function(errors, results, stats) {
});
results will be
{ 1: 'hello' }
errors will be
{ world: 'failed', test: 'failed'}