You can use Promise.all, which returns a new promise that resolves when all promises in the argument array are resolved.
Promise.all([myService.upload('upload1'), myService.upload('upload2')]).then(() => { // ... });
Note that if your myService.upload method returned Promise rather than Promise, you could get the return values โโas follows:
Promise.all([myService.upload('upload1'), myService.upload('upload2')]) .then((retValue1, retValue2) => { // ... });
source share