crazy_glue
v0.0.3
Published
Binding all of your async calls together
Downloads
6
Readme
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.on('done', function(errors, results) {
// Do something with arguments
});
results will be
{ 1: 'hello', 2: 'world', 3: 'test' }
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.on('done', function(errors, results) {
// Do something with arguments
});
results will be
{ 1: 'hello' }
errors will be
{ world: 'failed', test: 'failed'}
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) {
// stats.okCount == 2
// stats.errorCount == 3
});
results will be
{ 1: 'hello' }
errors will be
{ world: 'failed', test: 'failed'}