Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PublishRelay.asDriver() #1769

Closed
wants to merge 1 commit into from
Closed

Add PublishRelay.asDriver() #1769

wants to merge 1 commit into from

Conversation

dmcyk
Copy link

@dmcyk dmcyk commented Oct 15, 2018

This PR adds PublishRelay.asDriver() method.
Seems like PublishRelay is the only trait that's missing such conversion. All BehaviorRelay, ControlEvent and ControlProperty already implement asDriver.

@freak4pc
Copy link
Member

freak4pc commented Oct 15, 2018

Hey @dmcyk - Thanks for your contribution.
The fact Publish* cannot be turned into a Driver is not coincidental -

BehaviorRelay/BehaviorSubject model a State (hence it replays its latest value) and so does a Driver (models State).

PublishRelay/PublishSubject model Events (hence it does not replay latest value), but Driver is not intended for modeling events, as it requires replaying its latest event. The correct SharingStrategy for Publish* is actually a Signal - which is why asSignal is available for these units.

Hope this makes sense :)

Thanks again for the thought and assistance.
Shai.

@freak4pc freak4pc closed this Oct 15, 2018
@dmcyk
Copy link
Author

dmcyk commented Oct 15, 2018

oh I see. I wasn't aware of the separate Signal type Thanks for the explanation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants