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
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -79,7 +79,7 @@ class MyViewModel(private val postRepository: PostRepository)
79
79
80
80
Finally, inside your view class (`Activity`, `Fragment` or similar) you can emit actions to your state machine and observe state changes.
81
81
82
-
If you want to use a [built in LiveData state observer](https://github.com/adrielcafe/HAL/blob/master/hal-livedata/src/main/kotlin/cafe/adriel/hal/livedata/observer/LiveDataStateObserver.kt), just pass your `LifecycleOwner` to `viewModel.observeState()`, otherwise HAL will use a default [callback-based state observer](https://github.com/adrielcafe/HAL/blob/master/hal-core/src/main/kotlin/cafe/adriel/hal/observer/CallbackStateObserver.kt) (which is best suited for JVM-only applications).
82
+
If you want to use a [LiveData-based state observer](https://github.com/adrielcafe/HAL/blob/master/hal-livedata/src/main/kotlin/cafe/adriel/hal/livedata/observer/LiveDataStateObserver.kt), just pass your `LifecycleOwner` to `observeState()`, otherwise HAL will use a default [Callback-based state observer](https://github.com/adrielcafe/HAL/blob/master/hal-core/src/main/kotlin/cafe/adriel/hal/observer/CallbackStateObserver.kt) (which is best suited for JVM-only applications).
83
83
84
84
```kotlin
85
85
classMyActivity : AppCompatActivity() {
@@ -111,11 +111,11 @@ class MyActivity : AppCompatActivity() {
111
111
112
112
### Custom StateObserver
113
113
114
-
If needed, you can easily create your custom state observers by just implementing the `StateObserver<State>` interface:
114
+
If needed, you can easily create your custom state observers by implementing the `StateObserver<State>` interface:
115
115
116
116
```kotlin
117
117
classMyCustomStateObserver<S:HAL.State>(
118
-
privatevalmyCustomParam:SomeCoolClass,
118
+
privatevalmyAwesomeParam:MyAwesomeClass,
119
119
overridevalobserver: (S) ->Unit
120
120
) : StateObserver<S> {
121
121
@@ -129,7 +129,7 @@ class MyCustomStateObserver<S : HAL.State>(
129
129
And to use, just create an instance of it and pass to `observeState()` function:
130
130
131
131
```kotlin
132
-
viewModel.observeState(MyCustomStateObserver(myCustomParam) { state ->
132
+
viewModel.observeState(MyCustomStateObserver(myAwesomeParam) { state ->
0 commit comments