I\'m trying to do the following but it isn\'t working. How can I adjust the code to have a delay between .then and .done?
myServi
A slightly improved version of jfriend00's approach avoids needing the pass the resolved value like this:
function delay(t) {
return (val) => {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(val), t)
})
}
}
can be used like this:
myService.new(a)
.then(delay(60000))
.then(function(temp) {
return myService.get(a, temp);
}).then(function (b) {
console.log(b);
});