I have an rxjs.observable
(rxjs version 6.2.1) that returns urls
I need to make a GET
request to.
var subscription = urlObservable$.subscribe(
function (url) {
console.log('new URL: ' + url);
processURL(url)
},
function (err) { console.log('Error: ' + err); },
function () { console.log('Completed'); }
);
For every url
I need to make the request via the function processURL(url)
. What is the correct way, accordingly to the react philosophy, to process all this incoming urls and make the requests one by one instead of firing all of them as soon as the subscribe
emits data? Please note that in this case, the observable urlObservable$
will return data much faster than the request that needs to be made with the returned url
.
processURL
can return a promise
.
Thanks.