Procedure
Simple JS async development.
function fileLoader(path,done){
console.log("Opening file:'"+path+"'...");
if(path==='./secundary2.key'){
}
done.result({file:path});
}
var shared = {};
var procedure = new Procedure();
procedure
.add("Load primary",fileLoader,'./primary.key')
.add("Load secundary",fileLoader,'./secundary.key')
.add("Load shared",fileLoader,'./shared.key')
.race()
.add(function(files,done){
shared.files1 = files;
console.log(shared);
done();
})
.queue()
.add("Load primary",fileLoader,'./primary2.key')
.add("Load secundary",fileLoader,'./secundary2.key')
.add("Load shared",fileLoader,'./shared2.key')
.race()
.add(function(files,done){
shared.files2 = files;
console.log(shared);
done.result(shared);
})
.launch(function(errors){
if(errors){
console.log("END[ERROR]",arguments);
} else {
console.log("END[OK]",arguments);
}
})
;