Domanda

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

È stato utile?

Soluzione

Puoi farlo facilmente con combineAsArray o combineTemplate .Consentono di combinare flussi / proprietà e valori costanti.Ecco un esempio usando combineAsArray:

Bacon.fromArray(list)
  .flatMap(function(user){
    return Bacon.combineAsArray(
      user, Bacon.fromCallback(user, 'getClients')
    )
  })
  .onValues(function(user, clients){
    // handle result here
  })
.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top