MonotonicFrameClock

interface MonotonicFrameClock : CoroutineContext.Element

Provides a time source for display frames and the ability to perform an action on the next frame. This may be used for matching timing with the refresh rate of a display or otherwise synchronizing work with a desired frame rate.

Types

Key
Link copied to clipboard
common
object Key : CoroutineContext.Key<MonotonicFrameClock>

Functions

equals
Link copied to clipboard
common
open operator fun equals(other: Any?): Boolean
fold
Link copied to clipboard
common
open override fun <R> fold(initial: R, operation: (R, CoroutineContext.Element) -> R): R
get
Link copied to clipboard
common
open operator override fun <E : CoroutineContext.Element> get(key: CoroutineContext.Key<E>): E?
hashCode
Link copied to clipboard
common
open fun hashCode(): Int
minusKey
Link copied to clipboard
common
open override fun minusKey(key: CoroutineContext.Key<*>): CoroutineContext
plus
Link copied to clipboard
common
open operator fun plus(context: CoroutineContext): CoroutineContext
toString
Link copied to clipboard
common
open fun toString(): String
withFrameNanos
Link copied to clipboard
common
abstract suspend fun <R> withFrameNanos(onFrame: (frameTimeNanos: Long) -> R): 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.

Properties

key
Link copied to clipboard
common
open override val key: CoroutineContext.Key<*>

Inheritors

BroadcastFrameClock
Link copied to clipboard

Extensions

withFrameMillis
Link copied to clipboard
common
inline suspend fun <R> MonotonicFrameClock.withFrameMillis(crossinline onFrame: (frameTimeMillis: Long) -> R): 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.