coo

co based flow control

co-flow

A flow control library based on co.

Make co easy to use.

$ npm install coo
var fs = require('fs');
var coo = require('coo');
var files = ['file1', 'file2', 'file3'];
var size = function(file){
    return function(cb){
        fs.readFile(file, 'utf8', cb);
    }
}
 
 
coo(function* (){
    var res = yield coo.parallel(files, size, 5);
    console.log(res);
});
 
 
  • parallel(arr, fn[, n])
  • each(arr, fn)
  • map(arr, fn)
  • deferImmediate(gen, cb)
  • deferNextTick(gen, cb)
  • deferTimeout(gen, timeout, cb)
  • deferInterval(gen, timeout, cb)