If I deal with an arbitrary array which values have to be mapped to promises and it is crucial to wait for previous call completion before the next one performed, I usually follow this pattern:
const later = ms => new Promise(resolve => setTimeout(_ => resolve(console.log(ms)), ms)); console.log('chain start') let chain = Promise.resolve(); [1, 2, 3, ...].forEach(val => chain = chain.then(later.bind(null, val * 100))) chain.then(_ => console.log('chain end')) The important parts here are that 1 - we don't know how many items array could carry and 2 - we can't use Promise.all (consecutive calls or queue required).
The question is: What is the best RxJS way of doing so? So, observables instead of promises.
(I'm aware of .toPromise)