repeatOnLifecycle

abstract suspend fun repeatOnLifecycle(mode: SubscriptionMode, block: suspend CoroutineScope.() -> Unit)

Repeat the execution of the block using the specified mode.

This means that if the mode is no longer valid i.e. screen is not SubscriptionMode.Visible, the block parameter must be cancelled, and invoked again when the condition is satisfied again.

See also