Updater
A helper receiver scope class used by ComposeNode to help write code to initialized and update a node.
| See also | |
|---|---|
ComposeNode |
Summary
Public functions |
||
|---|---|---|
Unit |
Initialize emitted node. |
Cmn
|
Unit |
Initialize emitted node. |
Cmn
|
Unit |
Reconcile the node to the current state. |
Cmn
|
Unit |
Set the value property of the emitted node. |
Cmn
|
Unit |
Update the value of a property of the emitted node. |
Cmn
|
Public functions
init
fun init(block: T.() -> Unit): Unit
Initialize emitted node.
Schedule block to be executed after the node is created.
This is only executed once. The can be used to call a method or set a value on a node instance that is required to be set after one or more other properties have been set.
| See also | |
|---|---|
reconcile |
init
fun <V : Any?> init(value: V, block: T.(V) -> Unit): Unit
Initialize emitted node.
Schedule block to be executed after the node is created.
This is only executed once. The can be used to call a method or set a value on a node instance that is required to be set after one or more other properties have been set.
This is different from the other init overload in that it does not force creating a lambda to capture value.
reconcile
fun reconcile(block: T.() -> Unit): Unit
Reconcile the node to the current state.
This is used when set and update are insufficient to update the state of the node based on changes passed to the function calling ComposeNode.
Schedules block to execute. As this unconditionally schedules block to executed it might be executed unnecessarily as no effort is taken to ensure it only executes when the values block captures have changed. It is highly recommended that set and update be used instead as they will only schedule their blocks to executed when the value passed to them has changed.
set
fun <V : Any?> set(value: V, block: T.(value) -> Unit): Unit
Set the value property of the emitted node.
Schedules block to be run when the node is first created or when value is different than the previous composition.
| See also | |
|---|---|
update |
update
fun <V : Any?> update(value: V, block: T.(value) -> Unit): Unit
Update the value of a property of the emitted node.
Schedules block to be run when value is different than the previous composition. It is different than set in that it does not run when the node is created. This is used when initial value set by the ComposeNode in the constructor callback already has the correct value. For example, use [update} when value is passed into of the classes constructor parameters.
| See also | |
|---|---|
set |