aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/state
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/state')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/state/StateBinding.kt48
1 files changed, 23 insertions, 25 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/state/StateBinding.kt b/src/main/kotlin/pl/treksoft/kvision/state/StateBinding.kt
index adb7d3be..20cb2d8e 100644
--- a/src/main/kotlin/pl/treksoft/kvision/state/StateBinding.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/state/StateBinding.kt
@@ -49,7 +49,7 @@ class StateBinding<S : Any, CONT : Container, CONTENT>(
}
}
- private fun setUpdateState(updateState: (S, CONTENT) -> Unit) {
+ internal fun setUpdateState(updateState: (S, CONTENT) -> Unit) {
this.updateState = updateState
}
@@ -57,32 +57,30 @@ class StateBinding<S : Any, CONT : Container, CONTENT>(
unsubscribe()
super.dispose()
}
+}
- companion object {
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun <S : Any, CONT : Container> CONT.stateBinding(
- observableState: ObservableState<S>,
- factory: (CONT.(S) -> Unit)
- ): StateBinding<S, CONT, Unit> {
- return StateBinding(observableState, this, factory)
- }
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun <S : Any, CONT : Container> CONT.stateBinding(
+ observableState: ObservableState<S>,
+ factory: (CONT.(S) -> Unit)
+): StateBinding<S, CONT, Unit> {
+ return StateBinding(observableState, this, factory)
+}
- /**
- * DSL builder extension function for updateable redux content.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun <S : Any, CONT : Container, CONTENT> CONT.stateUpdate(
- observableState: ObservableState<S>,
- factory: (CONT.(S) -> CONTENT)
- ): Updateable<S, CONTENT> {
- return Updateable(StateBinding(observableState, this, factory)::setUpdateState)
- }
- }
+/**
+ * DSL builder extension function for updateable redux content.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun <S : Any, CONT : Container, CONTENT> CONT.stateUpdate(
+ observableState: ObservableState<S>,
+ factory: (CONT.(S) -> CONTENT)
+): Updateable<S, CONTENT> {
+ return Updateable(StateBinding(observableState, this, factory)::setUpdateState)
}
/**