awaitAnimationFrame

suspend fun Window.awaitAnimationFrame(): Double (source)

Platform and version requirements: JS

Suspends coroutine until next JS animation frame and returns frame time on resumption. The time is consistent with window.performance.now(). This function is cancellable. If the Job of the current coroutine is completed while this suspending function is waiting, this function immediately resumes with CancellationException.