https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
javascript
  • e

    Edouard Goossens

    03/13/2019, 11:45 AM
    Hi everyone, I’m creating JS modules from multiplatform projects using the kotlin-frontend-plugin. I have module2 depending on module1. When building module2, node_modules_imported includes module1, kotlin (as node package, with a generated package.json file), etc. But inside module1, there is another level of node_modules that also includes kotlin (as an isolated .js file, without package.json). I think this generates
    w: Module "kotlin" is defined in more than one file
    warnings. Is there a way to avoid that? Can I make npm aware of the fact that both packages depend on kotlin and it should only be included once? Thanks!
    g
    3 replies · 2 participants
  • g

    gumil

    03/13/2019, 9:35 PM
    do you have any idea why the gradle node plugin does not create node_modules in the
    nodeModulesDir
    that was set ?
    g
    9 replies · 2 participants
  • e

    Edouard Goossens

    03/14/2019, 11:53 AM
    In a multiplatform project, I have a common class with suspend functions. How can I call suspend functions from JavaScript? I could expose a callback version in the common code but I’d like to avoid that. I could also wrap this class in a JS-specific class that exposes Promises like
    async { suspendFunction() }.asPromise()
    . Is there a more elegant way that doesn’t require wrappers?
    r
    1 reply · 2 participants
  • a

    altavir

    03/15/2019, 5:15 PM
    I remember already asking this question somewhere, but I do not remember the answer. I have a tree-like object (not map of maps, but close to it), now I need this object to be converted to its structure copy represented as
    dynamic
    to be passed to JS library. What is the easiest way to do it?
    r
    s
    +1
    17 replies · 4 participants
  • d

    Dico

    03/15/2019, 5:48 PM
    Something like
    js("it")
    ?
    a
    1 reply · 2 participants
  • a

    altavir

    03/16/2019, 7:33 AM
    OK, it seems that I hit the wall with webpack... again (sorry). I have this file: https://github.com/root-project/jsroot/blob/master/scripts/JSRootGeoBase.js and its dependencies. I copy them into my resource directory so they could be visible for webpack, but I can't seem to find a way to make them visible from kotlin. I tried all combinations of
    JsModule
    and
    JsQualifier
    , but it does not seem to work. If I try to use
    require
    , the build is failing with a list of errors containing
    Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
    .
    1 reply · 1 participant
  • s

    spand

    03/20/2019, 9:16 AM
    It sucks a bit that
    ?.let {}
    doesnt use the extension function when receiver is dynamic. Anyone found a pattern just as concise way to express it ?
    g
    d
    15 replies · 3 participants
  • p

    Pavel Shorokhov

    03/21/2019, 7:34 PM
    How do you handle conditional classes?
    div("App-toolbar-button " + "App-toolbar-button__selected".takeIf { state.pageSelected == 0 }) {
    How to get rid of strings concat?
    c
    l
    +1
    6 replies · 4 participants
  • p

    Pavel Shorokhov

    03/21/2019, 11:46 PM
    I just discovered that
    JSON.parse<T>()
    won't fails with incorrect json and will continue works. For example:
    data class Car(val name: String)
    val car = JSON.parse<Car>("{\"qwe\":123}")
    This code will works and
    car.name
    will return undefined. Is there any way to check that json matches to specified structure?
    1 reply · 1 participant
  • j

    jw

    03/21/2019, 11:52 PM
    use kotlinx.serialization
    ❤️ 6
    p
    2 replies · 2 participants
  • l

    LeoColman

    03/22/2019, 2:07 AM
    How do I get an environment variable from Kotlin JS?
    r
    s
    2 replies · 3 participants
  • a

    altavir

    03/27/2019, 1:08 PM
    What is the easiest way to run js tests on mpp librarary? I am completely unfamiliar with JS testing frameworks, so I need minimal gradle configuration to run tests from
    jsTest
    source set.
    r
    r
    +2
    14 replies · 5 participants
  • r

    robstoll

    03/28/2019, 4:39 PM
    I have kind of implemented a ServiceLoader mechanism in JS and now I don't find the service (the registration of the service happens within B)
    a
    11 replies · 2 participants
  • a

    Artglorin

    04/01/2019, 8:52 AM
    Hello! Is somebody knows is there exists tool for convert a typescript source file to the kotlin js file?
    t
    3 replies · 2 participants
  • l

    Lawik

    04/01/2019, 9:33 AM
    Hi, does anyone have experience with the kotlin-react-redux wrapper? I am having a hard time connecting my container to the store.
    g
    p
    4 replies · 3 participants
  • w

    waqas

    04/04/2019, 6:52 AM
    message has been deleted
    l
    1 reply · 2 participants
  • v

    Vladyslav Sitalo

    04/04/2019, 2:54 PM
    Hi there - I want to build an Alfred workflow with kotlin, and I want to use https://github.com/sindresorhus/alfy library to do so. It’s my first time doing something meaningful with KotlinJs and I’m really confused on how to create a kotlin js app that would depend on npm module. Is there a good example/guide somewhere I can use?
    r
    c
    11 replies · 3 participants
  • v

    Vladyslav Sitalo

    04/07/2019, 5:08 PM
    I have a question on namespaces/naming/etc. Say I have a js module
    moduleName
    module.exports = {
        foo:  { /* some code here */ },
        C:  { /* some code here */ }
    }
    I can import it to kotlin like this:
    @file:JsModule("moduleName")
    package ext.jspackage.name
    
    external fun foo()
    
    external class C
    The problem with this is that if I want to use that functionality elsewhere in kotlin code - I’ll have to import the functions/objects directly. I.e. like
    import ext.jspackage.name.foo
    . Which is not great, as that name can be generic/etc. What I want is to recreate experience where I’d call the
    foo
    function with module name prefix -
    moduleName.foo()
    I can’t import modules in Kotlin though, and
    external
    things can’t be defined within non external ones, so I can’t do something like
    object moduleName {
        external fun foo()
    }
    Is there a way to accomplish this?
    s
    4 replies · 2 participants
  • g

    gbaldeck

    04/08/2019, 3:15 AM
    is the kotlin frontend plugin bundled in the kotlin-multiplatform plugin now?
    g
    a
    +1
    12 replies · 4 participants
  • r

    René

    04/09/2019, 5:05 AM
    Hey guys, is there a way to force kotlin to provide an array instead of an arraylist for the js implementation? For JVM I would like to use the ArrayList. Is there some kind of annotation or something?
    g
    13 replies · 2 participants
  • r

    René

    04/09/2019, 5:16 AM
    A second thing what I was unable to find tool to generate f.ts files. Is there something what I can use to provide type definitions for my mpp?
    g
    1 reply · 2 participants
  • g

    gbaldeck

    04/09/2019, 4:39 PM
    Hi guys, what are the current plans for KotlinJS? Like what are the primary features, changes, etc. the KotlinJS team are working on for this year?
    👍 2
    g
    a
    +1
    10 replies · 4 participants
  • d

    danfma

    04/10/2019, 10:27 PM
    Hey, guys!! After a long time I’m back! So, hi to everyone! 🙂
    👋 15
    g
    1 reply · 2 participants
  • s

    spand

    04/11/2019, 12:12 PM
    Why isnt
    finally
    present on
    Promise
    in kotlin-js-stdlib ?
    g
    4 replies · 2 participants
  • r

    Robert Jaros

    04/12/2019, 10:49 PM
    Looking at the changelog, you can not see many new things between 1.3.21 and 1.3.30. It's mostly a bugfix release. So why
    kotlin.js
    is more than 10% larger (+200KB)? This has a significant impact on the size of the output files for Kotlin/JS apps.
    i
    5 replies · 2 participants
  • r

    Robert Jaros

    04/13/2019, 11:09 PM
    I'm having a serious issue with 1.3.30 Kotlin/JS compiler. Is there anyone here who can help now?
    a
    3 replies · 2 participants
  • a

    Alexander Weickmann

    04/17/2019, 2:20 PM
    hey all. no kotlin react for 1.3.30 yet? http://dl.bintray.com/kotlin/kotlin-js-wrappers/org/jetbrains/kotlin-react/
    a
    1 reply · 2 participants
  • i

    Ilya Goncharov [JB]

    04/18/2019, 8:34 AM
    Hello guys, Could you please help, is there any way to configure .npmrc via kotlin frontend plugin? It is necessary for me to configure my own npm registry
    r
    1 reply · 2 participants
  • r

    Robert Jaros

    04/21/2019, 9:37 PM
    Almost two years of Kotlin programming with Kotlin/JS and I have no idea how to add new element to the JS array 😉 Any other idea than
    array.asDynamic().push(element)
    ?
    n
    1 reply · 2 participants
  • l

    Lawik

    04/24/2019, 10:20 AM
    (React)
    r
    2 replies · 2 participants
Powered by Linen
Title
l

Lawik

04/24/2019, 10:20 AM
(React)
r

Roman Artemev [JB]

04/24/2019, 10:22 AM
Could you please provide a bit more information, probably with minimal javascript sample?
l

Lawik

04/24/2019, 11:34 AM
I can't add a snippet to threads? I replied in the main channel.
View count: 1