bind

fun <Inputs : Any, Events : Any, State : Any, W : Component> W.bind(viewModel: BallastViewModel<Inputs, Events, State>, removeChildren: Boolean = true, runImmediately: Boolean = true, factory: W.(State) -> Unit): W(source)

An extension function which binds the widget to the given ballast view model.

Parameters

Inputs

the inputs type

Events

the events type

State

the state type

W

the widget type

viewModel

the ballast view model instance

removeChildren

remove all children of the component

runImmediately

whether to run factory function immediately with the current state

factory

a function which re-creates the view based on the given state


fun <Inputs : Any, Events : Any, State : Any, T, W : Component> W.bind(viewModel: BallastViewModel<Inputs, Events, State>, sub: (State) -> T, removeChildren: Boolean = true, runImmediately: Boolean = true, factory: W.(T) -> Unit): W(source)

An extension function which binds the widget to the given ballast view model using the sub extractor function.

Parameters

Inputs

the inputs type

Events

the events type

State

the state type

T

the sub state type

W

the widget type

viewModel

the ballast view model instance

sub

an extractor function

removeChildren

remove all children of the component

runImmediately

whether to run factory function immediately with the current state

factory

a function which re-creates the view based on the given state