Is there any functionality for an EventStream in ReactFX to cache the last value so it can be replayed to new subscribers? The RxJava Observable has a lot of procedures to do these kinds of tasks. I was hoping the EventStream might have a similiar functionality... unless I'm overlooking a reason why I would not want to do this in a GUI and I should stick to publish-only paradigms.
EventStream<Boolean> selectedEvt = EventStreams.changesOf(selected.selectedProperty())
.map(v -> v.getNewValue()).cache(1);
ReactFX does not have those. The idea is that if you want to remember a value, use an
ObservableValue/Valinstead of anEventStream. Turn theObservableValue/Valinto anEventStreamwhen necessary. Your above example can be rewritten more simply usingvaluesOf:Streams created by
valuesOfemit the current value of the underlyingObservableValueimmediately after subscription, so they mimic the replay behavior you describe.