Skip to content

//reactivestate/com.ensody.reactivestate.android/launchOnceStateAtLeast

launchOnceStateAtLeast

[android]\ fun LifecycleOwner.launchOnceStateAtLeast(state: Lifecycle.State, context: CoroutineContext = EmptyCoroutineContext, start: CoroutineStart = CoroutineStart.DEFAULT, cancelWhenBelow: Boolean = true, block: suspend CoroutineScope.() -> Unit): Job

Waits until the lifecycle reaches the given state and then launches a coroutine with the given block.

Parameters

android

cancelWhenBelow Pass false to keep the coroutine running even if the state falls below state.