Questions tagged [kotlin-js]
281 questions
2
votes
1 answer
Coroutines working but IntelliJ shows errors
I am working on a project using kotlinjs for nodejs and I start to learn coroutines and integrate them into my code to say goodbye to the callback hell.
I managed to get coroutines working, my code can be compiled and executed, everything seems…

Christoph Berghuber
- 81
- 1
- 2
- 5
2
votes
2 answers
Styling HTML elements at Kotlin-js
How can I style my HTML elements when using Kotlinx-html, I've my app working fine, then I tried to add styling using AZA-Kotlin, but once I imported azadev.kotlin It gave me error build
My full code is a s below:
Main.kt:
import…

Hasan A Yousef
- 22,789
- 24
- 132
- 203
2
votes
2 answers
How do I work with Redux/React in Kotlin.js?
I want to work with Redux/React in Kotlin.js, but I only found Redux/React libraries for Android (such as redux-kotlin).

dilvan
- 2,109
- 2
- 20
- 32
1
vote
0 answers
Using external CSS library in Kotlin/JS
I am not a frontend developer and not familiar with npm, yarn and this sort of tools.
However I want to render some data in a Kotlin/JS project.
Particularly, I want to use font-awesome icons in my page.
I've added implementation(npm("font-awesome",…

vahidreza
- 843
- 1
- 8
- 19
1
vote
0 answers
Specify module kind for kotlin/js compiler in multiplatform project
As stated in here, it is possible to compile Kotlin/JS to different modules. However, proposed solution doesn't work. When trying to add this block of code:
tasks.named("compileKotlinJs").configure {
…

llesha
- 423
- 1
- 15
1
vote
2 answers
window.getSelection() in Kotlin/JS
There is window.getSelection() in JS.
What is the equivalent in Kotlin/JS?
There is nothing in Kotlin Window API.

vahidreza
- 843
- 1
- 8
- 19
1
vote
1 answer
Kotlin/JS JAR-files contains no JS-files when downloaded manually. Why?
If I download a Kotlin/JS JAR-files manually from https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-serialization-core/1.3.3/pom or https://mvnrepository.com/artifact/org.jetbrains.kotlin-wrappers/kotlin-wrappers-bom/1.0.0-pre.501 then…

Jarl
- 57
- 8
1
vote
1 answer
How do I call a suspend function from a React button onClick event in Kotlin/JS?
I want to fetch some data when a button is pressed. I know how to do it using promises and continuations (see the sample below) but I'd like to learn how to do it using suspend functions.
As an example:
import kotlinx.browser.window
import…

Jordi
- 2,055
- 1
- 16
- 34
1
vote
1 answer
Problems with Kotlin react router dom element attribuute for binding a react component to URL
I'm currently working on a sample application to learn Kotlin/Js with the react library. When using the normal JSX syntax, a component can be set to be triggered when a specific URL hits using the BrowserRouter & Route API like below.
Main…

Kotlin Monk
- 105
- 5
1
vote
1 answer
Transforming a Flow to a Flow in Kotlin
Consider I have a cold source of UTF-8 bytes (e. g.: reading a file on disk, or the body of an HTTP response), in a form of a Flow. How do I convert the above source to a flow of strings?
In other words, I want the following behaviour:
…

Bass
- 4,977
- 2
- 36
- 82
1
vote
0 answers
KotlinJs: Unable to run jsBrowserTest in Google Cloudbuild due to "ReferenceError: setMetadataFor is not defined"
We have a very simple test in kotlinJs to check that a function we have in Javascript is read into kotlin and returns something:
JS code:
function: makeKey = (num) => { return 1000 + num }
Kotlin FFI code:
@JsNonModule
external object MyApp {
…

willjsporter
- 55
- 4
1
vote
2 answers
Kotlin Multiplatform/JS Unresolved reference Document.evaluate()
Context: Kotlin Multiplatform JavaScript.
I'm trying to use a Document.evaluate() but getting Unresolved reference: evaluate and Unresolved reference: XPathResult.
import org.w3c.dom.Document
import org.w3c.dom.parsing.DOMParser
object…

vovahost
- 34,185
- 17
- 113
- 116
1
vote
1 answer
How to pass pass values to constructor when instantiate kotlin class
Assuming I have a class like this
class Foo(private val someVal: String) : RComponent(){
...
}
which I instantiate like so
child(
Foo::class
) {
attrs.bar = props.bar
attrs.bar2 = props.bar2
...
}
How would I…

four-eyes
- 10,740
- 29
- 111
- 220
1
vote
1 answer
How can I add my own version of dukat in intellij idea
I am trying to generate external Declaration for a NPM package but it is giving errors
But when I tried the same with dukat@next version it worked
Tell me either how can I include my generated declarations to my kotlinJs project or how can I update…

AmAnVeRmA
- 13
- 2
1
vote
1 answer
kotlinc-js 1.8 doesn't seem to support IR
When compiling using the kotlin 1.8 sdk, for example :
kotlinc-js -version
One gets the following:
info: kotlinc-js 1.8.0 (JRE 19.0.1)
error: ==========
This project currently uses the Kotlin/JS Legacy compiler backend, which has been deprecated…

Richard
- 183
- 1
- 12