Package

rx.lang.scala

subjects

Permalink

package subjects

Subjects are Observers and Observables at the same time.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. subjects
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class AsyncSubject[T] extends Subject[T]

    Permalink
  2. class BehaviorSubject[T] extends Subject[T]

    Permalink
  3. class ReplaySubject[T] extends Subject[T]

    Permalink
  4. class SerializedSubject[T] extends Subject[T]

    Permalink
  5. class TestSubject[T] extends Subject[T]

    Permalink

Value Members

  1. object AsyncSubject

    Permalink

    Subject that publishes only the last item observed to each Observer that has subscribed, when the source Observable} completes.

    Subject that publishes only the last item observed to each Observer that has subscribed, when the source Observable} completes.

    Example:
    1. // observer will receive no onNext events because the subject.onCompleted() isn't called.
      val subject = AsyncSubject[String]()
      subject.subscribe(observer)
      subject.onNext("one")
      subject.onNext("two")
      subject.onNext("three")
      // observer will receive "three" as the only onNext event.
      val subject = AsyncSubject[String]()
      subject.subscribe(observer)
      subject.onNext("one")
      subject.onNext("two")
      subject.onNext("three")
      subject.onCompleted()
  2. object BehaviorSubject

    Permalink

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

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

    Example:
    1. // 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)
  3. object PublishSubject

    Permalink

    Subject that, once an Observer has subscribed, emits all subsequently observed items to the subscriber.

    Subject that, once an Observer has subscribed, emits all subsequently observed items to the subscriber.

    Example:
    1. val subject = PublishSubject[String]()
      // observer1 will receive all onNext and onCompleted events
      subject.subscribe(observer1)
      subject.onNext("one")
      subject.onNext("two")
      // observer2 will only receive "three" and onCompleted
      subject.subscribe(observer2)
      subject.onNext("three")
      subject.onCompleted()
  4. object ReplaySubject

    Permalink

    Subject that buffers all items it observes and replays them to any Observer that subscribes.

    Subject that buffers all items it observes and replays them to any Observer that subscribes.

    Example:
    1. val subject = ReplaySubject[String]()
      subject.onNext("one")
      subject.onNext("two")
      subject.onNext("three")
      subject.onCompleted()
      // both of the following will get the onNext/onCompleted calls from above
      subject.subscribe(observer1)
      subject.subscribe(observer2)
  5. object SerializedSubject

    Permalink

    Wraps a Subject to ensure that the resulting Subject is chronologically well-behaved.

    Wraps a Subject to ensure that the resulting Subject is chronologically well-behaved.

    A well-behaved Subject does not interleave its invocations of the onNext, onCompleted, and onError methods of its rx.lang.scala.Subjects; it invokes onCompleted or onError only once; and it never invokes onNext after invoking either onCompleted or onError.

    SerializedSubject enforces this, and the Subject it returns invokes onNext and onCompleted or onError synchronously on the wrapped Subject.

  6. object TestSubject

    Permalink

    A variety of Subject that is useful for testing purposes.

    A variety of Subject that is useful for testing purposes. It operates on a TestScheduler and allows you to precisely time emissions and notifications to the Subject's subscribers.

Inherited from AnyRef

Inherited from Any

Ungrouped