I'm writing Javascript which needs these events to happen in this order:
- Fire off several API calls simultaneously
- Once all calls have completed and responses have returned, execute a line of code
Sounds simple but the tricky part is that I can't use Promises.all() because I still want that line of code to execute after all promises have been fulfilled, successful or not. Unless I misunderstand Promises.all(), one failing would cause the line of code to not execute in then() and execute too soon in error().
I very well might be missing something obvious but the only other way I can see would be to chain the API call promises together but that would result in not firing them all at once. So basically I think I need a version of Promises.all() that isn't "fail-fast".
What's the proper way to do this?