Skip to content

Commit b27964a

Browse files
kotlin.browser => kotlinx.browser
mark scope as private to avoid name clash use reactivestreams / coroutine snippet for KMongo support
1 parent 00286de commit b27964a

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/jsMain/kotlin/Api.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import io.ktor.client.request.*
44
import io.ktor.client.features.json.JsonFeature
55
import io.ktor.client.features.json.serializer.KotlinxSerializer
66

7-
import kotlin.browser.window
7+
import kotlinx.browser.window
88

99
val endpoint = window.location.origin // only needed until https://github.com/ktorio/ktor/issues/1695 is resolved
1010

src/jsMain/kotlin/App.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import kotlinext.js.*
44
import kotlinx.html.js.*
55
import kotlinx.coroutines.*
66

7-
val scope = MainScope()
7+
private val scope = MainScope()
88

99
val App = functionalComponent<RProps> { _ ->
1010
val (shoppingList, setShoppingList) = useState(emptyList<ShoppingListItem>())

src/jvmMain/kotlin/Server.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@ import io.ktor.serialization.*
99
import io.ktor.server.engine.*
1010
import io.ktor.server.netty.*
1111
import org.litote.kmongo.*
12-
import org.litote.kmongo.async.*
1312
import org.litote.kmongo.coroutine.*
14-
import org.litote.kmongo.async.getCollection
1513
import com.mongodb.ConnectionString
14+
import org.litote.kmongo.reactivestreams.KMongo
1615

1716
val connectionString: ConnectionString? = System.getenv("MONGODB_URI")?.let {
1817
ConnectionString("$it?retryWrites=false")
1918
}
2019

21-
val client = if (connectionString != null) KMongo.createClient(connectionString) else KMongo.createClient()
20+
val client = if (connectionString != null) KMongo.createClient(connectionString).coroutine else KMongo.createClient().coroutine
2221
val database = client.getDatabase(connectionString?.database ?: "test")
2322
val collection = database.getCollection<ShoppingListItem>()
2423

0 commit comments

Comments
 (0)