onActive

fun onActive(callback: CommitScope.() -> Unit)

An effect used to observe the lifecycle of the composition. The callback will execute once initially after the first composition is applied, and then will not fire again. The callback will get executed with a receiver scope that has an onDispose method which can be used to schedule a callback to be executed once whenever the effect leaves the composition

The onActive effect is essentially a convenience effect for onCommit(true) { ... }.

See also

Parameters

callback

The lambda to execute when the composition commits for the first time and becomes active.