kotlin-js

Gradle doesn't emit kotlin.js

﹥>﹥吖頭↗ 提交于 2020-01-22 20:15:31
问题 I'm trying to compile my Kotlin app and set of Kotlin libraries to JavaScript. I've got that working well, but when I try to run it it can't find kotlin.js . So what's going on here? When I compile using IDEA (instead of Gradle), it outputs kotlin.js just fine. I tried making my build script more like an example I found, but that wouldn't compile... Here's a link to the code and project in question: https://github.com/BlueHuskyStudios/Decision-Cruncher/blob/SO/q/53582651/1/build.gradle 回答1:

Could not find method srcDirs() for arguments on SourceSet container of type org.gradle.api.internal.tasks.DefaultSourceSetContainer

橙三吉。 提交于 2019-12-24 21:05:59
问题 I'm trying to compile my Kotlin app and set of Kotlin libraries to JavaScript. I've got that working well, but when I try to run it, it can't find kotlin.js. To remedy this, I tried changing my build.gradle to be more like this example on GitHub. In mine, I defined source sets like this: (which works but doesn't output kotlin.js ) sourceSets { main { kotlin { srcDirs 'src/main/kotlin' } } } to something like this: (which doesn't even sync) sourceSets { main.kotlin.srcDirs += "src/main/kotlin"

Gradle doesn't emit kotlin.js

爷,独闯天下 提交于 2019-12-05 05:59:30
I'm trying to compile my Kotlin app and set of Kotlin libraries to JavaScript. I've got that working well, but when I try to run it it can't find kotlin.js . So what's going on here? When I compile using IDEA (instead of Gradle), it outputs kotlin.js just fine. I tried making my build script more like an example I found, but that wouldn't compile ... Here's a link to the code and project in question: https://github.com/BlueHuskyStudios/Decision-Cruncher/blob/SO/q/53582651/1/build.gradle For any others struggling in the future, I've had the following issue: IntelliJ Kotlin/JS starter project

javascript anonymous object in kotlin

流过昼夜 提交于 2019-12-03 16:13:01
问题 how to create JavaScript anonymous object in kotlin? i want to create exactly this object to be passed to nodejs app var header = {“content-type”:”text/plain” , “content-length” : 50 ...} 回答1: Possible solutions: 1) with js function: val header = js("({'content-type':'text/plain' , 'content-length' : 50 ...})") note: the parentheses are mandatory 2) with dynamic : val d: dynamic = object{} d["content-type"] = "text/plain" d["content-length"] = 50 3) with js + dynamic : val d = js("({})") d[

javascript anonymous object in kotlin

流过昼夜 提交于 2019-12-03 05:26:36
how to create JavaScript anonymous object in kotlin? i want to create exactly this object to be passed to nodejs app var header = {“content-type”:”text/plain” , “content-length” : 50 ...} Possible solutions: 1) with js function: val header = js("({'content-type':'text/plain' , 'content-length' : 50 ...})") note: the parentheses are mandatory 2) with dynamic : val d: dynamic = object{} d["content-type"] = "text/plain" d["content-length"] = 50 3) with js + dynamic : val d = js("({})") d["content-type"] = "text/plain" d["content-length"] = 50 4) with native declaration: native class Object {