File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
src/androidMain/kotlin/dev/icerock/moko/javascript Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,13 @@ android {
1919 exclude(" META-INF/AL2.0" )
2020 exclude(" META-INF/LGPL2.1" )
2121 }
22+
23+ sourceSets {
24+ getByName(" androidTest" ).java.srcDirs(
25+ file(" src/androidAndroidTest/kotlin" ),
26+ file(" src/mobileDeviceTest/kotlin" )
27+ )
28+ }
2229}
2330
2431kotlin {
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ actual class JavaScriptEngine actual constructor() {
4343 context : Map <String , JsType >,
4444 script : String
4545 ): JsType {
46- val scriptWithContext = convertContextMapToJsScript(context) + script
46+ val scriptWithContext = convertContextMapToJsScript(context) + script + " \n "
4747 val result = quickJs.evaluate(scriptWithContext)
4848 return handleQuickJsResult(result)
4949 }
@@ -63,10 +63,14 @@ actual class JavaScriptEngine actual constructor() {
6363 is JsType .DoubleNum -> valueWrapper.value.toString()
6464 is JsType .Json -> valueWrapper.value.let {
6565 Json .encodeToString(JsonElement .serializer(), it)
66+ }.let {
67+ it.replace(" \" " , " \\\" " )
6668 }.let {
6769 " JSON.parse(\" $it \" )"
6870 }
6971 is JsType .Str -> valueWrapper.value.let {
72+ it.replace(" \" " , " \\\" " )
73+ }.let {
7074 " \" $it \" "
7175 }
7276 JsType .Null -> null
You can’t perform that action at this time.
0 commit comments