Google is committed to advancing racial equity for Black communities. See how.

CompositionCoroutineScope

abstract class CompositionCoroutineScope : CoroutineScope, CompositionFrameClock
kotlin.Any
   ↳ androidx.compose.CompositionCoroutineScope

A CoroutineScope used for launching side effects of a composition that also permits awaiting the next presentation frame of the composition. This can be useful for performing the next action of an animation while the effect is still present in the composition.

Summary

Public constructors

A CoroutineScope used for launching side effects of a composition that also permits awaiting the next presentation frame of the composition.

Public methods
suspend Long

Inherited functions
Extension functions
From androidx.compose
suspend Nothing
CompositionCoroutineScope.awaitDispose(onDispose: () -> Unit = {})

Suspends the current coroutine until the effect is disposed and the CompositionCoroutineScope is cancelled, and invokes onDispose before resuming.

Inherited extension functions
From androidx.compose
suspend R
CompositionFrameClock.awaitFrameMillis(crossinline onFrame: (frameTimeMillis: Long) -> R)

Suspends until a new frame is requested, immediately invokes onFrame with the frame time in nanoseconds in the calling context of frame dispatch, then resumes with the result from onFrame.

suspend Long

Suspends until a new frame is requested, returning the frame time in milliseconds.

suspend Long

Suspends until a new frame is requested, returning the frame time in nanoseconds.

suspend R
CompositionFrameClock.withFrameMillis(crossinline onFrame: (frameTimeMillis: Long) -> R)

Suspends until a new frame is requested, immediately invokes onFrame with the frame time in nanoseconds in the calling context of frame dispatch, then resumes with the result from onFrame.

Public constructors

<init>

CompositionCoroutineScope()

A CoroutineScope used for launching side effects of a composition that also permits awaiting the next presentation frame of the composition. This can be useful for performing the next action of an animation while the effect is still present in the composition.

Public methods

awaitFrame

suspend fun awaitFrame(): Long

Deprecated.