insertWhen

fun <S, W : SimplePanel> W.insertWhen(signal: Signal<S>, condition: (S) -> Boolean, removeChildren: Boolean = true, runImmediately: Boolean = true, factory: SimplePanel.(S) -> Unit): SimplePanel(source)

An extension function which inserts child component and binds it to the observable state when the given condition is true.

Parameters

signal

the Signal instance

removeChildren

remove all children of the child 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

Type Parameters

S

the state type

W

the container type


fun <S, T, W : SimplePanel> W.insertWhen(signal: Signal<S>, sub: (S) -> T, condition: (T) -> Boolean, removeChildren: Boolean = true, runImmediately: Boolean = true, factory: SimplePanel.(T) -> Unit): SimplePanel(source)

An extension function which inserts child component and binds it to the given signal using the substate extractor when the given condition is true.

Parameters

signal

the Signal instance

sub

an extractor function for substate

removeChildren

remove all children of the child 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

Type Parameters

S

the state type

T

the substate type

W

the container type