Browsers are not supported yet, it will be added later.
kuji.inline
runs tasks in-line:
var kuji = require('kuji');
kuji.inline([
function (next) {
next();
},
function (next) {
next();
},
function (next) {
next();
},
function (next) {
next();
}
]);
kuji.parallel
runs tasks in parallel and goes to the final callback when all tasks finished:
var kuji = require('kuji');
kuji.parallel([
function (next) {
next();
},
function (next) {
next();
},
function (next) {
next();
},
function (next) {
next();
}
], function () {
// This will be executed when all will be finished
});
kuji.graph
permits you to easily run tasks graphs:
You can see that D will be executed once its dependencies (A and B) are finished, permitting you to be sure that the data you need from these tasks will be available.
var kuji = require('kuji'),
dependsOn = kuji._dependsOn;
kuji.graph({
a: function (next) {
next()
},
b: function (next) {
next();
},
c: function (next) {
next();
},
d: dependsOn(['a', 'b'], function (next) {
next();
}),
e: dependsOn(['d', 'c'], function (next) {
next();
})
}, function () {
// This will be executed at the end of your graph
});
For the moment you need to use a closure to share data between tasks, but this will be patched in the next few days.
- Error handling through
next()
- Passing values through
next()
- Benchmark
- Perfomance optimization
To run the tests :
mocha
MIT