I'm trying to perform multiple simultaneous ajax request to a REST api and get a stream that emits a value with a data structure containing the data retrieved by all the responses altogether. For this I'm using zip but I'm getting the following exception from Bacon.js:
Uncaught Error: At least one EventStream required
As an example, below there is a simplified version of my code:
let profileStreams = [];
let profiles = {
someURL: {
href: 'www.google.com'
},
someOtherURL: {
href: 'github.com'
},
yetAnotherURL: {
href: 'twitter.com'
}
};
for (let index in profiles) {
profileStreams.push(
b$.ajax({
url: profiles[index].href
}).map((profileObject) => {
return {
owner: index,
profile: profileObject
};
})
);
}
let allUrlsRetrievedAsArray = Bacon.zipAsArray(profileStreams);