Bacon.fromArray(list)
.flatMap(function(user){
return Bacon.fromCallback(user, 'getClients');
})
.onValue(function(clients){
// need `user` object some how
})
;
Need user
object in onValue
callback
Bacon.fromArray(list)
.flatMap(function(user){
return Bacon.fromCallback(user, 'getClients');
})
.onValue(function(clients){
// need `user` object some how
})
;
Need user
object in onValue
callback
You can do it easily with combineAsArray
or combineTemplate
. They allow combining streams/properties and constant values. Here is an example using combineAsArray
:
Bacon.fromArray(list)
.flatMap(function(user){
return Bacon.combineAsArray(
user, Bacon.fromCallback(user, 'getClients')
)
})
.onValues(function(user, clients){
// handle result here
})