client: reactfx->rx

This commit is contained in:
Andras Slemmer 2016-08-30 15:26:13 +01:00
parent 91508efbd4
commit 5af593cae4

View File

@ -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>()