object BehaviorSubject
Subject that emits the most recent item it has observed and all subsequent observed items to each subscribed
Observer.

// observer will receive all events. val subject = BehaviorSubject[String]("default") subject.subscribe(observer) subject.onNext("one") subject.onNext("two") subject.onNext("three") // observer will receive the "one", "two" and "three" events, but not "zero" val subject = BehaviorSubject[String]("default") subject.onNext("zero") subject.onNext("one") subject.subscribe(observer) subject.onNext("two") subject.onNext("three") // observer will receive only onCompleted val subject = BehaviorSubject[String]("default") subject.onNext("zero") subject.onNext("one") subject.onCompleted() subject.subscribe(observer) // observer will receive only onError val subject = BehaviorSubject[String]("default") subject.onNext("zero") subject.onNext("one") subject.onError(new RuntimeException("error")) subject.subscribe(observer)
- Alphabetic
- By Inheritance
- BehaviorSubject
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
apply[T](defaultValue: T): BehaviorSubject[T]
Creates a
BehaviorSubjectthat emits the last item it observed and all subsequent items to eachObserverthat subscribes to it.Creates a
BehaviorSubjectthat emits the last item it observed and all subsequent items to eachObserverthat subscribes to it.- defaultValue
the item that will be emitted first to any
Observeras long as theBehaviorSubjecthas not yet observed any items from its sourceObservable- returns
the constructed
BehaviorSubject
-
def
apply[T](): BehaviorSubject[T]
Creates a
BehaviorSubjectwithout a default item.Creates a
BehaviorSubjectwithout a default item.- returns
the constructed
BehaviorSubject
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()