Questions tagged [kotlin-js]

281 questions
0
votes
0 answers

Kotlin inline functions in javascript with proper code line results in console

I want to write a simple helper logging function in kotlin-js, like so: inline fun log(block: () -> String){ kotlin.js.console.log("[LOG] ${block()}") } But when using it like log{ "Processing..." }, the console still prints the line where the…
er453r
  • 211
  • 2
  • 11
0
votes
1 answer

issue in including kotlinx-data-time libray in kotlinjs project

FAILURE: Build failed with an exception. What went wrong: Could not determine the dependencies of task ':packageJson'. Could not resolve all dependencies for configuration ':npm'. Could not resolve…
3bdoelnaggar
  • 1,109
  • 8
  • 18
0
votes
1 answer

How to use JSONObject from Kotlin JS

I am new to Kotlin JS. I am trying to port the business logic of my android app to Kotlin JS. My app uses the class org.json.JsonObject to do custom serialization. I can't use KotlinX serialization with annotations because my classes are inline and…
Duane
  • 86
  • 9
0
votes
1 answer

How Kotlin type reification works on kotlin-js?

On JVM reified types provide a work around for the type erasure. Why does reification work in the same manner on kotlin-js? (i.e only with inline functions). Why not all types reify-able?
0
votes
1 answer

How can I use a Javascript library in Kotlin/JS?

I'm current learning how to use KotlinJS for web design and I can't figure out how to use a library like AnimeJS in my projects. Please advise me on how I can do this.
Emekarr
  • 111
  • 2
  • 7
0
votes
1 answer

Can i use kotlinx.html with document in kotlin-js?

Now i work on kotlin-js project. And i want to Add some HTML tag in my index.html. So i want to use kotlinx.html. Is it available using kotlinx.html in kotlin-js code? Like This one import kotlin.browser.document document.create.p{+"hello…
0
votes
1 answer

Kotlin JS error Ktor client resolving 'fs'

I'm trying to build a Kotlin JS application targeting the browser. I wan't to request a REST API with Ktor Client, Kotlin Serialization and Coroutines. My build.gradle.kts look like this: dependencies { val serializationVersion = "0.20.0" …
elcolto
  • 961
  • 7
  • 11
0
votes
1 answer

How to use MessageEventInit with window.addEventListener

I am trying to register a webmessage channel using kotlin-js, but am unable to determine how to get access to the MessageEventInit type. https://kotlinlang.org/api/latest/jvm/stdlib/org.w3c.dom/-message-event-init/index.html The…
dazza5000
  • 7,075
  • 9
  • 44
  • 89
0
votes
1 answer

kotlin multiplatform (js, jvm) build with time management libraries

i would like to have the same algorithm on backend (jvm) and frontend (js). the algorithm needs some date/time operations and therefore will rely on some external library. for js there is something like 'moment' for jvm there is standard …
piotrek
  • 13,982
  • 13
  • 79
  • 165
0
votes
1 answer

What files does the firebase client upload for firebase functions?

What does the firebase client need to upload the firebase functions? All I can identify is that it takes my files from my lib directory, does something to them, and then uploads everything. Does it take my dependencies also? How does this work? The…
0
votes
0 answers

How to make the browser recognise a breakpoint set in some external Kotlin library in Kotlin/Js?

Currently, I'm using this Kotlin/Js version: id("org.jetbrains.kotlin.js") version "1.3.70-eap-184" I have configured source map generation: target { browser { compilations.all { kotlinOptions { …
night-crawler
  • 1,409
  • 1
  • 26
  • 39
0
votes
2 answers

In Kotlin JS calling getHours on a date gives TypeError: date.getHours is not a function

Hopefully this is a common issue that someone can help me with ? I've got a data class that has a kotlin,js.Date on it. If I print out the value of it via console.log I get: 2019-12-29T13:30:00.000+0000 I'm trying to get the hours portion so I…
PaulNUK
  • 4,774
  • 2
  • 30
  • 58
0
votes
1 answer

Kotlin multiplatform node.js project fails due to "Error: Cannot find module '...'"

I have built a Kotlin multiplatform library and published it to bintray. When trying to include it in a sample node.js application it will be able to find the dependency, but compiling will fail with the following…
mikepenz
  • 12,708
  • 14
  • 77
  • 117
0
votes
0 answers

Redirect to another web page in Kotlin Web Front End development

I am trying to redirect to another web page in Kotlin for Web Front End development. I have wrote this code to achieve this: window.location.href = "adduser1.html" But if I write this code then, the code written after this line are not executing.…
Avijit Karmakar
  • 8,890
  • 6
  • 44
  • 59
0
votes
1 answer

How to depend on a maven local jar when using create-react-kotlin-app https://github.com/JetBrains/create-react-kotlin-app

I want to build a frontend in kotlin/react. I want it to be able to depend on common artefacts written in kotlin. These artefacts will be in my local maven repo. How do I reference these in package.json?
Funzo
  • 1,190
  • 2
  • 14
  • 25
1 2 3
18
19