I am starting to use RxJS and I don't understand why in this example we need to use a function like flatMap
or concatAll
; where is the array of arrays here?
var requestStream = Rx.Observable.just('https://api.github.com/users');
var responseMetastream = requestStream
.flatMap(function(requestUrl) {
return Rx.Observable.fromPromise(jQuery.getJSON(requestUrl));
});
responseMetastream.subscribe(url => {console.log(url)})
If someone can visually explain what is happening, it will be very helpful.