RxState

General

Category
Free
Tag
FRP
License
MIT License
Registered
Feb 24, 2017
Favorites
1
Link
https://github.com/konmik/rxstate
See also
RxActions
RxFunctions
RxWindowIfChanged
RxSealedUnions
FunctionalAndroidReference

Additional

Language
Java
Version
N/A
Created
Jan 2, 2017
Updated
Jan 8, 2017
Owner
Konstantin Mikheev (konmik)
Activity
Badge
Generate
Download
Source code

Announcement

RxState

This project is implementation of ideas from Managing state reactive way article.

RxJava1 dependency

dependencies {
    compile 'com.konmik.rxstate:rxstate1:0.1.0-beta1'
}
RxJava2 dependency

dependencies {
    compile 'com.konmik.rxstate:rxstate2:0.1.0-beta1'
}

Usage

Code (RxJava1):

    RxState<Integer> state = new RxState<>(0, Schedulers.immediate());
    state.values(StartWith.SCHEDULE)
            .subscribe(it -> System.out.println(it));
    state.apply(it -> it + 1);

Code (RxJava2):

    RxState<Integer> state = new RxState<>(0, Schedulers.single());
    state.values(StartWith.SCHEDULE)
            .subscribe(it -> System.out.println(it));
    state.apply(it -> it + 1);

Prints:

0
1