public static class Reactor.DefaultImpls
A Reactor is an UI-independent layer which manages the state of a view. The foremost role of a
interface Reactor is to separate control flow from a view. Every view has its corresponding interface Reactor and
delegates all logic to its interface Reactor. A interface Reactor has no dependency to a view, so it can be easily
tested.
Reference: https://github.com/ReactorKit/ReactorKit
| Modifier and Type | Method and Description |
|---|---|
static io.reactivex.Observable<? extends State> |
createStateStream(Reactor<Action,Mutation,State> $this)
Creates the State stream by transforming the Action relay to a State observable.
|
static io.reactivex.Observable<? extends Mutation> |
mutate(Reactor<Action,Mutation,State> $this,
Action action)
Commits mutation from the Action. This is the best place to perform side-effects such as
async tasks.
|
static State |
reduce(Reactor<Action,Mutation,State> $this,
State state,
Mutation mutation)
Generates a new state with the previous State and the Action. It should be purely functional
so it should not perform any side-effects here. This method is called every time when
the Mutation is committed.
|
static io.reactivex.Observable<? extends Action> |
transformAction(Reactor<Action,Mutation,State> $this,
io.reactivex.Observable<Action> action)
Transforms the Action. Use this function to combine with other observables. This method is
called once before the state stream is created.
|
static io.reactivex.Observable<? extends Mutation> |
transformMutation(Reactor<Action,Mutation,State> $this,
io.reactivex.Observable<Mutation> mutation)
Transforms the Mutation stream. Implement this method to transform or combine with other
observables. This method is called once before the state stream is created.
|
static io.reactivex.Observable<State> |
transformState(Reactor<Action,Mutation,State> $this,
io.reactivex.Observable<State> state)
Transforms the State stream. Use this function to perform side-effects such as logging. This
method is called once after the state stream is created.
|
public static io.reactivex.Observable<? extends Mutation> mutate(Reactor<Action,Mutation,State> $this, Action action)
Commits mutation from the Action. This is the best place to perform side-effects such as async tasks.
public static State reduce(Reactor<Action,Mutation,State> $this, State state, Mutation mutation)
Generates a new state with the previous State and the Action. It should be purely functional so it should not perform any side-effects here. This method is called every time when the Mutation is committed.
public static io.reactivex.Observable<? extends Action> transformAction(Reactor<Action,Mutation,State> $this, io.reactivex.Observable<Action> action)
Transforms the Action. Use this function to combine with other observables. This method is called once before the state stream is created.
public static io.reactivex.Observable<? extends Mutation> transformMutation(Reactor<Action,Mutation,State> $this, io.reactivex.Observable<Mutation> mutation)
Transforms the Mutation stream. Implement this method to transform or combine with other observables. This method is called once before the state stream is created.
public static io.reactivex.Observable<State> transformState(Reactor<Action,Mutation,State> $this, io.reactivex.Observable<State> state)
Transforms the State stream. Use this function to perform side-effects such as logging. This method is called once after the state stream is created.
public static io.reactivex.Observable<? extends State> createStateStream(Reactor<Action,Mutation,State> $this)
Creates the State stream by transforming the Action relay to a State observable.