Is there a way to guarantee Promise.all
resolves after the then
chain of an inner promise?
Example:
const promiseOne = new Promise((resolve, reject) => {
setTimeout(function(){
console.log('promiseOne after 1 second')
resolve()
}, 1000)
}).then(()=> {
setTimeout(function(){
console.log('promiseOne then chain, after 2 seconds')
}, 1000)
})
Promise.all([promiseOne])
.then(() => {
console.log('Promise.all then chain after 1 second')
})
Logs:
promiseOne after 1 second
Promise.all then chain after 1 second
promiseOne then chain, after 2 seconds