LifecycleCoroutineScope
-
Cmn
abstract class LifecycleCoroutineScope : CoroutineScope
CoroutineScope tied to a Lifecycle and Dispatchers.Main.immediate
This scope will be cancelled when the Lifecycle is destroyed.
Summary
Public functions |
||
|---|---|---|
Job |
This function is deprecated. launchWhenCreated is deprecated as it can lead to wasted resources in some cases. |
android
|
Job |
This function is deprecated. launchWhenResumed is deprecated as it can lead to wasted resources in some cases. |
android
|
Job |
This function is deprecated. launchWhenStarted is deprecated as it can lead to wasted resources in some cases. |
android
|
Inherited properties |
||||||
|---|---|---|---|---|---|---|
|
Public functions
launchWhenCreated
funlaunchWhenCreated(block: suspend CoroutineScope.() -> Unit): Job
Launches and runs the given block when the Lifecycle controlling this LifecycleCoroutineScope is at least in Lifecycle.State.CREATED state.
The returned Job will be cancelled when the Lifecycle is destroyed.
| See also | |
|---|---|
whenCreated |
|
coroutineScope |
launchWhenResumed
funlaunchWhenResumed(block: suspend CoroutineScope.() -> Unit): Job
Launches and runs the given block when the Lifecycle controlling this LifecycleCoroutineScope is at least in Lifecycle.State.RESUMED state.
The returned Job will be cancelled when the Lifecycle is destroyed.
| See also | |
|---|---|
whenResumed |
|
coroutineScope |
launchWhenStarted
funlaunchWhenStarted(block: suspend CoroutineScope.() -> Unit): Job
Launches and runs the given block when the Lifecycle controlling this LifecycleCoroutineScope is at least in Lifecycle.State.STARTED state.
The returned Job will be cancelled when the Lifecycle is destroyed.
| See also | |
|---|---|
whenStarted |
|
coroutineScope |