Skip to main content

Chasm embedder

Chasm is an experimental WebAssembly runtime built on Kotlin Multiplatform.

Key Features:

  • Kotlin Multiplatform solution.
  • Compatible with Android API 26+ and JVM JDK 17+.
  • Single threaded only.

Installation:

dependencies {
testImplementation("at.released.wasm-sqlite-driver:sqlite-embedder-chasm:0.1-beta03")

// Sqlite WebAssembly binary
testImplementation("at.released.wasm-sqlite-driver:sqlite-android-wasm-emscripten-icu-349:0.7")
}

Usage:

val factory = WasmSqliteOpenHelperFactory(ChasmSqliteEmbedder) {
// Configuration of the Chasm embedder
embedder {
sqlite3Binary = SqliteAndroidWasmEmscriptenIcu349
}
}

Just like with the Chicory embedder, when used with a room, a single-threaded coroutine dispatcher should be used.

newSingleThreadContext("RoomDatabase").use { singleThreadContext ->
val db = Room.databaseBuilder()
.setDriver(wasmSqliteDriver)
.setQueryCoroutineContext(singleThreadContext)
.build()
// …
}