You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a snippet of groovy code that will probably do most of what you want.
input = from([1,2,3,4])
// we are going to be branching off of the input observable three times so cache it.cached = input.cache()
// produce an observable that is the fraction completed. In this case 0.25, 0.5, 0.75, 1fract = cached.reduce(0, {count,value -> count+1}).mapMany({size -> cached.mapWithIndex({value,index -> (index+1)/size})})
// zip the fraction observable with the values to sync the timing of the values coming out with the fraction of completionoutput = Observable.zip(cached,fract, {value, fractionDone ->
// side effect to update progress bar with fraction done.println"done $fractionDone"returnvalue
})
// OR// if updating the status of a progress bar produces an observable you'll have to use this for the last zipoutput = Observable.merge(Observable.zip(cached,fract, {value, fractionDone ->
// operation to update progress bar with fraction done results in an observable tooupdate = just("done $fractionDone")
returnzip(just(value), update, {value2, updateStatus -> value2})
}))
No description provided.
The text was updated successfully, but these errors were encountered: