Skip to content

Latest commit

 

History

History
46 lines (37 loc) · 1.09 KB

README.md

File metadata and controls

46 lines (37 loc) · 1.09 KB

Release

RxProperty

A Delegated Property that is also an RxJava Observable.

Example

Code:

val fooProperty = RxProperty("initial")
var foo by fooProperty

fooProperty.subscribe(::println)
foo = "hello"
foo = "hello"
foo = "world"

Output:

hello
hello
world

Adding RxProperty to your Project

You can add this project as a dependency via JitPack.

repositories {
    jcenter()
    maven { url "https://jitpack.io" }
}
dependencies {
     compile 'io.github.snarks:RxProperty:1.0'
}

(com.github.snarks will also work)

Behaviour

  • It will never emit onError or onComplete
  • It will emit onNext immediately after a value is assigned to it
  • It does not operate by default on a particular Scheduler

Thread Safety

It's not safe to assign values to RxProperty from multiple threads, but the usual RxJava operations are thread-safe.