Package-level declarations

The platform primitives: each one gives common code something that only some targets have.

Start here:

  • ioDispatcher: the dispatcher for blocking calls, on every target.

  • asyncWithProgress: an async that also publishes its progress.

  • WeakRef: a weak reference from common code.

  • Platform.current: the OS name, version and device model.

Types

Link copied to clipboard
object KiteCore

Build facts about the KiteCore library.

Link copied to clipboard
class Platform

Where the code runs: the OS name, the OS version, the device model and a family to branch on.

Link copied to clipboard

The kind of platform the code runs on, for when branches in common code.

Link copied to clipboard
class Progress(fraction: Float?, val phase: String? = null)

One progress report: how far the operation is (fraction) and what it does now (phase).

Link copied to clipboard
class ProgressFuture<out T>

A running operation that you can await, plus its live progress.

Link copied to clipboard
sealed interface ProgressScope : CoroutineScope

The receiver of an asyncWithProgress block: a CoroutineScope that can report progress and split the bar into slices.

Link copied to clipboard
expect class WeakRef<T : Any>(referred: T)

A reference that does not keep its object alive, from common code.

Properties

Link copied to clipboard
expect val ioDispatcher: CoroutineDispatcher

The dispatcher for blocking calls (file reads, sockets, JDBC) from common code.

Functions

Link copied to clipboard
fun <T> CoroutineScope.asyncWithProgress(context: CoroutineContext = EmptyCoroutineContext, start: CoroutineStart = CoroutineStart.DEFAULT, block: suspend ProgressScope.() -> T): ProgressFuture<T>

Starts a coroutine like async, and also publishes its progress as a StateFlow.

Link copied to clipboard
expect fun installIoDispatcher(dispatcher: CoroutineDispatcher)

Sets the dispatcher that ioDispatcher returns on JS and Wasm.

Link copied to clipboard
fun <T> Deferred<T>.withProgress(progress: StateFlow<Progress>): ProgressFuture<T>

Joins a Deferred and a progress flow that you already have into one ProgressFuture.