public static class Reactor.DefaultImpls
A Reactor is an UI-independent layer which manages the state of a view. The foremost role of a reactor is to separate control flow from a view. Every view has its corresponding reactor and delegates all logic to its reactor. A 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 void |
clear(Reactor<Action,Mutation,State> $this)
Clears the state stream disposable.
|
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.
public static void clear(Reactor<Action,Mutation,State> $this)
Clears the state stream disposable.