aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-remote
diff options
context:
space:
mode:
Diffstat (limited to 'kvision-modules/kvision-remote')
-rw-r--r--kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt2
-rw-r--r--kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/Utils.kt14
2 files changed, 8 insertions, 8 deletions
diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt
index 52c0f7c3..06e150e4 100644
--- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt
+++ b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt
@@ -198,7 +198,7 @@ interface RemoteAgent {
}
}
- private fun findEnumValue(kClass: KClass<Any>, value: String): Any? {
+ fun findEnumValue(kClass: KClass<Any>, value: String): Any? {
return (kClass.asDynamic().jClass.values() as Array<Any>).find {
it.asDynamic().name == value
}
diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/Utils.kt b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/Utils.kt
index c4f4ed6d..465fbf59 100644
--- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/Utils.kt
+++ b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/Utils.kt
@@ -22,8 +22,9 @@
package pl.treksoft.kvision.remote
import kotlinx.serialization.SerializationStrategy
-import kotlinx.serialization.context.SimpleModule
import kotlinx.serialization.json.Json
+import kotlinx.serialization.json.JsonConfiguration
+import kotlinx.serialization.modules.serializersModuleOf
import pl.treksoft.kvision.types.JsonDateSerializer
import kotlin.browser.window
import kotlin.js.Date
@@ -45,13 +46,12 @@ fun obj(init: dynamic.() -> Unit): dynamic {
*/
object JSON {
- val plain = Json().apply {
- install(SimpleModule(Date::class, JsonDateSerializer))
- }
+ val plain = Json(context = serializersModuleOf(Date::class, JsonDateSerializer))
- val nonstrict = Json(strictMode = false).apply {
- install(SimpleModule(Date::class, JsonDateSerializer))
- }
+ val nonstrict = Json(
+ configuration = JsonConfiguration.Stable.copy(strictMode = false),
+ context = serializersModuleOf(Date::class, JsonDateSerializer)
+ )
/**
* An extension function to convert Serializable object to JS dynamic object