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 current value property to BehaviorSubject #1897

Closed
dalewking opened this issue Nov 20, 2014 · 3 comments
Closed

Add current value property to BehaviorSubject #1897

dalewking opened this issue Nov 20, 2014 · 3 comments

Comments

@dalewking
Copy link
Contributor

Rx 2.2 added a current value property that would come in handy. See discussion here: https://rx.codeplex.com/workitem/8

@akarnokd
Copy link
Member

Hello! A PR is welcome, but note the following:

  • Unlike Rx.NET, BehaviorSubject doesn't remember the very last onNext value before an onCompleted: completed subject emits only onCompleted to subscribers.
  • The last known value is a NotificationLite object which might be null indicating a BehaviorSubject without default initial value.
  • What should the method be called? value(), getValue(), current(), getCurrent() ?
  • How should it propagate the various states: (empty, has value, has exception, terminated)? Perhaps via Notification?
  • If it returns the last value directly, what exceptions should indicate empty and terminated states? NoSuchElementException?

@akarnokd
Copy link
Member

Please check out #2470 for a set of Subject API changes that includes your current value.

@akarnokd
Copy link
Member

akarnokd commented Feb 5, 2015

Subjects have been enhanced in 1.0.5 with methods that get you their current state.

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

No branches or pull requests

2 participants