jabbit

fun jabbit(configure: JabbitScope.() -> Unit): Jabbit(source)

Creates a Jabbit for whichever platform the code is running on, from a single description that lives in common code.

val jabbit = jabbit {
worker(SyncJob) { SyncWorker(api) }
logger(JabbitLogger.Console)

android { }

ios {
backgroundTaskIdentifier = "com.example.app.jabbit"
}

desktop {
applicationName = "Example"
}

browser {
queueName = "example"
}
}

Every platform block is optional and only the one matching the current platform is read, so the same call compiles and runs everywhere. Nothing is passed in from platform code: on Android the application context is picked up automatically before any application code runs.

The platform createJabbit functions stay available for the cases this cannot cover — handing Android a specific Context, or getting back the AutoCloseable desktop instance.

Throws

when the current platform needs a setting the description does not provide, such as desktop { applicationName }.