You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,12 +3,12 @@
3
3
4
4
Mini is a minimal Flux architecture written in Kotlin that also adds a mix of useful features to build UIs fast.
5
5
6
-
###Purpose
6
+
## Purpose
7
7
You should use this library if you aim to develop a reactive application with good performance (no reflection using code-gen).
8
8
Feature development using Mini is fast compared to traditional architectures (like CLEAN or MVP), low boilerplate and state based models make feature integration and bugfixing easy as well as removing several families of problems like concurrency or view consistency across screens.
9
9
10
-
###How to Use
11
-
## Dispatcher
10
+
## How to Use
11
+
###Dispatcher
12
12
The *Dispatcher* is the hub that manages all data flow in a Flux application. It is basically a holder of store callbacks: each store registers itself and provides a callback for an action.
13
13
14
14
One important thing is that the dispatching is always performed in the same thread to avoid possible side-effects.
The *Stores* are holders for application state and state mutation logic. In order to do so they expose pure reducer functions that are later invoked by the dispatcher.
28
28
29
29
The state is a plain object (usually a `data class`) that holds all information needed to display the view. States should always be inmutable. State classes should avoid using framework elements (View, Camera, Cursor...) in order to facilitate testing.
@@ -47,7 +47,7 @@ class SessionStore @Inject constructor(val controller: SessionController) : Stor
47
47
}
48
48
```
49
49
50
-
## Actions
50
+
###Actions
51
51
An *Action* is a simple class that usually represents a use case. It can also contain a payload that includes data to perform said action. When an action is triggered, it will be delivered via dispatcher to the stores that are going to do something with the action to change their state.
52
52
53
53
For example, we may want to log in to a service. We would create an action like this one:
@@ -62,11 +62,11 @@ data class LoginCompleteAction(val loginTask: Task, val user: User?)
62
62
63
63
Actions will usually be triggered from Views or Controllers.
64
64
65
-
## Generated code
65
+
###Generated code
66
66
67
67
🚧WIP🚧
68
68
69
-
## View changes
69
+
###View changes
70
70
Each ``Store`` exposes a custom `StoreCallback` though the method `observe` or a `Flowable` if you want to make use of RxJava. Both of them emits changes produced on their states, allowing the view to listen reactive the state changes. Being able to update the UI according to the new `Store` state.
71
71
72
72
```kotlin
@@ -83,7 +83,7 @@ Each ``Store`` exposes a custom `StoreCallback` though the method `observe` or a
83
83
84
84
If you make use of the RxJava methods, you can make use of the `SubscriptionTracker` interface to keep track of the `Disposables` used on your activities and fragments.
85
85
86
-
## Tasks
86
+
###Tasks
87
87
A Task is a basic object to represent an ongoing process. They should be used in the state of our `Store` to represent ongoing processes that must be represented in the UI.
88
88
89
89
Given the example Stores and Actions explained before, the workflow will be:
@@ -102,7 +102,7 @@ Mini includes some utility extensions over RxJava 2.0 to make easier listen stat
102
102
-`select`: Like `mapNotNull` but avoiding repeated values.
103
103
-`onNextTerminalState`: Used to map a `Task` inside an state and listen the next terminal state(Success - Error). Executing a different closure depending of the result of the task.
104
104
105
-
###Navigation
105
+
## Navigation
106
106
To avoid loops over when working with navigation based on a process result. You will need to make use of `onNextTerminalState` after dispatch and `Action` that starts a process which result could navigate to a different screen.
0 commit comments