OnLifecycleEvent

fun OnLifecycleEvent(lifecycleEvent: Lifecycle.Event, lifecycleOwner: LifecycleOwner = LocalLifecycleOwner.current, key1: Any? = null, key2: Any? = null, callback: () -> Unit)

Run the given callback inside of a LifecycleEventObserver launched as a DisposableEffect, when the lifecycleOwner reaches the given lifecycleEvent and clean up the observer when lifecycleOwner, key1 or key2 changes or if OnLifecycleEvent leaves the composition.

See also