Comments (9)
I understand what you mean, a workaround could be subscribing with method references:
Subject subject = ...
Disposable disposable = myEventsObservable.subscribe(subject::onNext, subject::onError, subject::onComplete);
from rxjavafx.
I've tested different scenarios, and I can say Subject
is a most straight forward solution than CompositeObservable
. I'm just re-thinking about all common scenarios involving concurrency , although ideally CompositeObservable
should be used to listen UI events from other layer, as events are always produced on JavaFx Application Thread, theorically there should be no problem.
from rxjavafx.
Yes those were kind of my thoughts. I have thought about making an FXSubject that would handle serialization and observing on the FX thread. I havent entirely dismissed that idea but in a great majority of cases, emissions going in and out should already be on the FX thread anyway. I can see occasional situations it might be useful though...
from rxjavafx.
I have found a potentially serious issue: subscribing a subject does not return a Disposable
.
from rxjavafx.
Explain this issue a little more. The only subscribe implementation that doesn't return a Disposable
in Observable
is public final void subscribe(io.reactivex.Observer<? super T> observer)
and all Subjects
inherit this method.
from rxjavafx.
I'll post a better example tomorrow, but...
Subject subject = ...
myEventsObservable.subscribe(subject); // Does not return Disposable
from rxjavafx.
Yup, good thought. I looked at my implementation of CompositeObservable and that is exactly what I did.
I'm a tad unsure what to do here... whether to tell users to do that subscribe() trick themselves, implement a new utility, or keep things as is.
Too bad Java doesn't have extension functions like Kotlin. Those would be pretty handy for this problem right now...
from rxjavafx.
I wonder if its possible creating a Subject implementation that does all this, and can have a dispose() method on it.
from rxjavafx.
I think I'm going to deprecate. I see @akarnokd gave a thumbs up to the subject route, so that's enough to push me out of my quandary.
from rxjavafx.
Related Issues (20)
- Ebook Learning RxJava with JavaFX not navigatable HOT 3
- Additional Transformer factories HOT 1
- Getting index in ListChange HOT 1
- Help with Deployment of 2.11 HOT 20
- Java 11 Automatic-Module-Name HOT 2
- JavaFxObservable.valuesOf(fxObservable, nullSentinel) does not emmit first nullSentinel HOT 1
- JavaFxObservable.valuesOf() and Bindings.bindBidirectional() strange behaviour. HOT 3
- JavaFxObservable.actionEventsOf().subscribeOn(Schedulers.newThread()) misses some emissions HOT 3
- 2.11.0-RC16 / error: cannot access JavaFxObserver HOT 4
- Mockito complaining with Java 11/Gradle 5 HOT 1
- No factories should subscribeOn() the Platform thread
- JavaFxObserver#onError: custom implementation HOT 1
- Need help with maintenance, call for collaborators HOT 9
- Support scene accelerators HOT 4
- Change object not emitted when observed property had changed to null
- A typo on Gitbook guide
- It looks like passing all the tests with openjfx 13.0.1 HOT 2
- Error - cannot access io.reactivex.Observable HOT 1
- Is there a plan to use RXJava 3 ? HOT 2
- Setting up a new build chain for stable/nightly releases.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rxjavafx.