Extensions for org.w3c.dom.Window

asCoroutineDispatcher

JS
fun Window.asCoroutineDispatcher(): CoroutineDispatcher

Converts an instance of Window to an implementation of CoroutineDispatcher.

awaitAnimationFrame

JS
suspend fun Window.awaitAnimationFrame(): Double

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.