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
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.