I have multiple promises fetching different assets. I want to achieve:
- Executing some code first to handle some of these promises via
then()
. - When everything is resolved/fetched, executing some code that launches my app via
Promise.all().then()
.
I need to make sure 1 is excuted before 2. It does seem to work from what I have tested.
// handle promises one by one
promise1.then(results => {});
promise2.then(results => {});
// common process that should come after the above then()s
Promise.all([promise1, promise2])
.then(results => {});
But can I rely on it? Are "single" then()
always executed before a then()
on Promise.all()
?