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
+34-2Lines changed: 34 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,9 +11,34 @@
11
11
![badge][badge-wasm]
12
12
13
13
14
-
Documentation to come.
14
+
Write concise multiplatform presenter functions with presenter-middleware:
15
+
16
+
```
17
+
interface StartView : GameBaseView {
18
+
fun showLoading()
19
+
fun hideLoading()
20
+
fun showError(msg: String)
21
+
22
+
override fun presenter(): Presenter<View, AppState> = startPresenter
23
+
}
24
+
25
+
val startPresenter = presenter<StartView> {
26
+
{
27
+
select { state.isLoadingItems } then {
28
+
if (state.isLoadingItems) {
29
+
showLoading()
30
+
} else {
31
+
hideLoading()
32
+
}
33
+
}
34
+
35
+
select { state.errorLoadingItems } then { showError(state.errorMsg) }
36
+
}
37
+
}
38
+
39
+
```
40
+
Presenter-middleware handles wiring this up to your view and store subscriptions. Just implement the interface on Android and iOS and dispatch lifecycle events. See the [ReadingList sample app](https://github.com/reduxkotlin/ReadingListSampleApp) or the [Name Game Sample App](https://github.com/reduxkotlin/NameGameSampleApp) for example usage.
15
41
16
-
Example usage:
17
42
18
43
19
44
__How to add to project:__
@@ -31,6 +56,13 @@ kotlin {
31
56
}
32
57
```
33
58
59
+
Add the presetner store-enhancer:
60
+
```
61
+
val appStore = createStore(reducer, AppState.INITIAL_STATE,
0 commit comments