mirror of
https://github.com/corda/corda.git
synced 2024-12-19 04:57:58 +00:00
client: reactfx->rx
This commit is contained in:
parent
91508efbd4
commit
5af593cae4
@ -5,13 +5,13 @@ import javafx.beans.property.SimpleObjectProperty
|
||||
import javafx.beans.value.ObservableValue
|
||||
import javafx.collections.FXCollections
|
||||
import javafx.collections.ObservableList
|
||||
import org.reactfx.EventStream
|
||||
import rx.Observable
|
||||
|
||||
/**
|
||||
* Simple utilities for converting an [EventStream] into an [ObservableValue]/[ObservableList]
|
||||
* Simple utilities for converting an [rx.Observable] into an [ObservableValue]/[ObservableList]
|
||||
*/
|
||||
|
||||
fun <A, B> EventStream<A>.foldToObservable(initial: B, folderFun: (A, B) -> B): ObservableValue<B> {
|
||||
fun <A, B> Observable<A>.foldToObservable(initial: B, folderFun: (A, B) -> B): ObservableValue<B> {
|
||||
val result = SimpleObjectProperty<B>(initial)
|
||||
subscribe {
|
||||
Platform.runLater {
|
||||
@ -21,7 +21,7 @@ fun <A, B> EventStream<A>.foldToObservable(initial: B, folderFun: (A, B) -> B):
|
||||
return result
|
||||
}
|
||||
|
||||
fun <A, B, C> EventStream<A>.foldToObservableList(
|
||||
fun <A, B, C> Observable<A>.foldToObservableList(
|
||||
initialAccumulator: C, folderFun: (A, C, ObservableList<B>) -> C
|
||||
): ObservableList<B> {
|
||||
val result = FXCollections.observableArrayList<B>()
|
||||
|
Loading…
Reference in New Issue
Block a user