From b7901e371f148bedd105b1f91c5485ec6e9a2f48 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Tue, 2 Jun 2020 23:45:18 +0200 Subject: Add parameter of bind, for not removing children when binding component to the state --- src/main/kotlin/pl/treksoft/kvision/state/StateBinding.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/main/kotlin/pl/treksoft/kvision/state') diff --git a/src/main/kotlin/pl/treksoft/kvision/state/StateBinding.kt b/src/main/kotlin/pl/treksoft/kvision/state/StateBinding.kt index 6c8090b7..457af0e4 100644 --- a/src/main/kotlin/pl/treksoft/kvision/state/StateBinding.kt +++ b/src/main/kotlin/pl/treksoft/kvision/state/StateBinding.kt @@ -13,13 +13,15 @@ import pl.treksoft.kvision.core.Widget.Companion.bindState * @param S the state type * @param W the widget type * @param observableState the state + * @param removeChildren remove all children of the component * @param factory a function which re-creates the view based on the given state */ fun W.bind( observableState: ObservableState, + removeChildren: Boolean = true, factory: (W.(S) -> Unit) ): W { - return this.bindState(observableState, factory) + return this.bindState(observableState, removeChildren, factory) } /** -- cgit