Skip to content

A Delegated Property that is also an RxJava Observable

License

Notifications You must be signed in to change notification settings

snarks/RxProperty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A Delegated Property that is also an RxJava Observable

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages