setTimeOut y crear directorio nodejs
function Job {
function taskA() {
return new Promise(resolve => {
setTimeout(function() {
resolve('result A');
}, 1000);
});
}
function taskB(arg) {
return new Promise(resolve => {
setTimeout(function() {
resolve('result B of ' + arg);
}, 1000);
});
}
// would allow this chain:
this.work = () => {
taskA()
.then(resA => taskB(resA))
.then(resB => console.log(resB));
}
}
Bah Keith