Main

Utilizes the UI CoroutineDispatcher under the hood to transition events from a background thread, to the UI thread. For Java Compose Desktop, the MainUIDispatcher is used, otherwise Dispatchers.Main (if available).

NOTE: Jvm/Android requires the respective coroutines UI dependency kotlinx-coroutines-{android/javafx/swing}, UNLESS the following conditions are met:

  • Android: If you are using the runtime-service dependency which already has the kotlinx-coroutines-android dependency.

  • Java: If you are using Compose for Desktop

    • Skiko's MainUIDispatcher will be used in this event. The Swing dependency is only necessary for tests if you want them to run on Dispatchers.Main.

NOTE: On Node.js this invokes Executable immediately as the kmp-tor implementation is entirely asynchronous and runs on the main thread.

WARNING: Non-Darwin native targets do not have Dispatchers.Main resulting in an exception when execute is invoked, unless you have implemented Dispatchers.Main yourself for those native platforms.

Properties

Link copied to clipboard
@get:JvmName(name = "isAvailable")
val isAvailable: Boolean

Helper for checking if Dispatchers.Main that backs this Executor is available or not.

Functions

Link copied to clipboard
open override fun execute(handler: CoroutineContext, executable: Executable)

Execute executable in desired context.