for the below posted code, at the run time, the log message:
console.log('xcx ended')
gets displayed first before the code in the first .then()
is executed.
i want the log message console.log('xcx ended')
is to be displayed after the execution of the code in the first .then()
is finished.
how can i achieve that please
code:
await Promise.all(promises)
.then(promise => {
promise.forEach((responses, index) => {
console.log('xcx promise:',promise)
console.log('xcx response:',response)
responses.forEach(response => {
response.then(data => {
this.#msg = {msg:verboseTag + 'connectWSGeoTIFFsAsBlobsStreamerFor().', data: data};
console.log(this.#msg);
this.#geoTIFFOverlayBlobStreamingStates.value = GeoTIFFOverlayBlobStreamingStates.CONST_BLOB_OBTAINED.description;
this.#setWSGeoTIFFAsBlobStreamerResults({
order: order,
geoTIFFFileName: data[0],
asBlob: data[1],
asURL: data[2],
state: data[3],
});
resolve(response);
onResult(data[0], data[1], data[2], data[3]);
})
})
})
})
.then(() => {
console.log('xcx ended')
})
explained in the question