const co = require('co');
const func1 = function(){
setTimeout(()=>{
console.log('func1');
},2000);
}
const func2 = function(){
setTimeout(()=>{
console.log('func2');
},2000);
}
const func3 = function(){
console.log('func3');
}
const gen = co.wrap(function*(){
yield func1;
yield func2;
return yield func3;
});
gen()
.then(function(){console.log('end')});
The expected result is func1 func2 func3 end
but it doesn't show what I intended.
It is showing func1
How can I fix the code to output the expected result