onCommit

inline fun onCommit(noinline callback: CommitScope.() -> Unit)

The onCommit effect is a lifecycle effect that will execute callback every time the composition commits. It is useful for executing code in lock-step with composition that has side-effects. The callback will get executed with a receiver scope that has an onDispose method which can be used to schedule a callback to schedule code that cleans up the code in the callback.

See also

Parameters

callback

The lambda to be executed when the effect is committed to the composition.

fun <V1> onCommit(v1: V1, callback: CommitScope.() -> Unit)

The onCommit effect is a lifecycle effect that will execute callback every time the inputs to the effect have changed. It is useful for executing code in lock-step with composition that has side-effects that are based on the inputs. The callback will get executed with a receiver scope that has an onDispose method which can be used to schedule a callback to schedule code that cleans up the code in the callback.

See also

Parameters

callback

The lambda to be executed when the effect is committed to the composition.

v1

The input which will be compared across compositions to determine if callback will get executed.

fun <V1, V2> onCommit(v1: V1, v2: V2, callback: CommitScope.() -> Unit)

The onCommit effect is a lifecycle effect that will execute callback every time the inputs to the effect have changed. It is useful for executing code in lock-step with composition that has side-effects that are based on the inputs. The callback will get executed with a receiver scope that has an onDispose method which can be used to schedule a callback to schedule code that cleans up the code in the callback.

See also

Parameters

callback

The lambda to be executed when the effect is committed to the composition.

v1

An input value which will be compared across compositions to determine if callback will get executed.

v2

An input value which will be compared across compositions to determine if callback will get executed.

fun onCommit(vararg inputs: Any?, callback: CommitScope.() -> Unit)

The onCommit effect is a lifecycle effect that will execute callback every time the inputs to the effect have changed. It is useful for executing code in lock-step with composition that has side-effects that are based on the inputs. The callback will get executed with a receiver scope that has an onDispose method which can be used to schedule a callback to schedule code that cleans up the code in the callback.

See also

Parameters

callback

The lambda to be executed when the effect is committed to the composition.

inputs

A set of inputs which will be compared across compositions to determine if callback will get executed.