https://kotlinlang.org logo
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
  • j

    jkbbwr

    09/15/2018, 11:52 PM
    Okay so new question, im doing some interop I am getting many errors like this
    Can't access class 'EventEmitter' marked with @JsModule annotation from non-modular project
    b
    • 2
    • 3
  • g

    gildor

    09/17/2018, 11:18 PM
    What kind issues did you have?
    a
    n
    b
    • 4
    • 15
  • j

    josephivie

    09/18/2018, 3:27 AM
    For the Kotlin Frontend plugin: What do you need to do to get subproject dependencies from the
    dependencies{}
    block to be used in the
    resolve
    block inside
    webpack.config.js
    ?
    b
    • 2
    • 1
  • j

    josephivie

    09/18/2018, 3:31 AM
    I have the https://github.com/wojta/hello-kotlin-multiplatform project doing just that, but I can't find any differences between my project and it. Any help would be appreciated.
    • 1
    • 1
  • a

    Allan Wang

    09/19/2018, 1:47 AM
    I currently have a backend made in kotlin, consisting of a gradle submodule with data models. Is there any chance I can reuse those models in a react frontend component? How would it work in importing those modules, or would I have to copy them over? To add more context, the frontend is currently made from create-react-kotlin-app, and api calls return objects
    b
    • 2
    • 1
  • d

    Dico

    09/19/2018, 5:00 AM
    @Allan Wang Are you asking if you can refer to the same submodule from different Gradle roots? I wouldn't recommend that. Consider building an artifact for the subproject and adding it as a dependency, or, even better, make it it's own Gradle project. I didn't answer the question here - sorry. I don't know if you can.
    a
    • 2
    • 1
  • z

    Zukkari

    09/19/2018, 1:30 PM
    Hey everyone. Is there a resource somewhere on how to create Kotlin bindings for a Javascript library?
    b
    • 2
    • 2
  • f

    fabianterhorst

    09/20/2018, 4:28 PM
    How can i create an external class that represents the result of an require("") call in nodejs
    g
    • 2
    • 1
  • f

    fabianterhorst

    09/20/2018, 5:04 PM
    an working solution for now is
    private external fun require(module: String): MyModule
    
    fun get(): MyModule {
                return require("myModule")
    }
    
    external interface MyModule {
        fun myMethod(...)
    }
    g
    j
    • 3
    • 6
  • h

    Hamza

    09/23/2018, 10:00 AM
    hi everyone, im getting into kotlin with javascript, and im getting an error while creating a basic file: im not sure what the issue is though. im using gradle with the build tool ‘assembleWeb’ which comes from the https://kotlinlang.org/docs/tutorials/javascript/getting-started-gradle/getting-started-with-gradle.html example on the website, so im a bit confused what’s wrong
    g
    n
    • 3
    • 12
  • h

    Hamza

    09/23/2018, 12:04 PM
    i just wrote my first nodejs application in kotlin - this is so cool!!! 😄
    👍 1
    m
    • 2
    • 2
  • h

    Hamza

    09/23/2018, 2:01 PM
    how do we use kotlin to declare a
    new
    type of a variable? so for instance, if i have this code:
    val discord = require("discord.js")
    // how can i declare 
    val bot = js("new discord.Client();")
    without losing type safety, as the
    new
    keyword doesn’t exist. is it in the kotlinjs lib? omitting the word throws an error
    j
    • 2
    • 4
  • d

    dawitt

    09/24/2018, 11:59 AM
    Hi everyone! I updated Kotlin today and I’m running into some issues. In my project, code like this used to run fine but I’m now getting an
    TypeError: ArrayList_init_0 is not a function
    runtime error.
    console.log("here")
    val jsArray = js("[1,2,3]") as Array<Int>
    val result = jsArray.filter { it < 5 }
    The project compiles without problems and Intellij shows no warnings. Has anybody else experienced similar issues or has any ideas how to resolve this?
    h
    • 2
    • 7
  • s

    sdeleuze

    09/26/2018, 10:05 PM
    https://kotlinlang.slack.com/archives/C3SGXARS6/p1537999506000100
    n
    • 2
    • 1
  • f

    functionaldude

    09/28/2018, 8:32 AM
    Hi! I have a kotlin.js react app (which was created with kotlin’s own
    create-react-app
    script but it is already “ejected”) and i’m trying to write an IndexedDB wrapper. I need the
    kotlinx.coroutines.core
    library but somehow I can’t add it to the project as dependency… I added it as dependency to my
    package.json
    , it seems to be installed (the files are already in the node_modules folder) but autocompletion does not work and I can’t use any functions from it. What am I doing wrong?
    • 1
    • 1
  • b

    bashor

    09/28/2018, 1:21 PM
    Wow, Kotlin/JS vacancy in a bank.
    Apart from implementing requested business features and regulatory requirements the team is focusing in consolidating all frontend technologies into one HTML/KotlinJS solution. Several applications have already been migrated but many are waiting. The development is fully strongly typed including Client to Server communication. Kotlin Type Safe Builders are used for layout construction. Selenium is used for test automation.
    https://barclays.taleo.net/careersection/2/jobdetail.ftl?job=90164661
    🎉 10
    r
    n
    j
    • 4
    • 8
  • s

    spierce7

    10/02/2018, 3:06 AM
    Is it possible yet to export a kotlin-js library, and also have it auto-generate typescript definitions?
    j
    b
    • 3
    • 3
  • r

    robstoll

    10/04/2018, 2:38 PM
    I am missing something or is there no external interface for WeakMap defined out of the box?
    b
    • 2
    • 2
  • g

    gbaldeck

    10/04/2018, 3:05 PM
    Didn't get to watch the keynote today, any Kotlin/JS announcements?
    b
    d
    • 3
    • 5
  • s

    sdeleuze

    10/04/2018, 3:36 PM
    I will go to the Kotlin/JS booth to discuss that tomorrow morning with the team
    👍 3
    ✅ 1
    o
    • 2
    • 2
  • n

    Navrocky Vlad

    10/07/2018, 4:37 PM
    Hello, is there a way to write unit tests in project created with create-kotlin-react-app ?
    j
    • 2
    • 1
  • t

    tarek

    10/07/2018, 5:52 PM
    Hello Do you know why does building a Kotlin/JS project from IDEA add the
    lib
    folder with all dependencies (
    kotlin.js
    etc.) but not when building from Gradle
    assemble
    (I find only the compiled Kotlin as js files) ?
    n
    • 2
    • 2
  • g

    gbaldeck

    10/07/2018, 11:11 PM
    in the new multiplatform gradle setup, how do we specify js options?
    o
    h
    • 3
    • 9
  • c

    coletz

    10/08/2018, 8:10 AM
    Hi guys, someone know if it's possible to create an extension function for "dynamic" ?
    g
    r
    • 3
    • 8
  • h

    hallvard

    10/08/2018, 11:31 AM
    Well, @tarek, that seems to solve my case too, thanks. But the new 1.3 based gradle stuff explicitly demands that I tell IntelliJ to leave compilation and building to gradle, so I now have to find those «corresponding tutorials» mentioned in the last sentence you pasted. Until now, I haven't found any that explains how to get the kotlin.js into my jar files or anything ...
    t
    • 2
    • 3
  • h

    hallvard

    10/08/2018, 1:52 PM
    Testing it now. I can confirm the first part of this works (when I change
    File file ->
    into simply
    file ->
    ). When this task is performed, I find the kotlin.js file in the lib directory, as expected. But I have a hard time finding out how to make my sourceSet
    jsMain
    dependOn this. The `dependsOn`clause is no good here ("Could not find method dependsOn() for arguments [task ':linkJs'] on target js (js) of type org.jetbrains.kotlin.gradle.plugin.mpp.KotlinOnlyTarget."). Will examine further tomorrow.
    t
    g
    • 3
    • 3
  • c

    coletz

    10/08/2018, 5:23 PM
    Totally not a js dev. I'm using a js lib (puppeteer) that needs
    const browser = await puppeteer.launch()
    . My issue is that I can't use await with kotlin js, and I don't know if "await" is just syntactic sugar for a callback (sort of stuff done on Java with coroutines)
    c
    g
    • 3
    • 4
  • c

    coletz

    10/09/2018, 3:11 PM
    Another noob question: I'm trying to use JSDOM and the js import is:
    const jsdom = require("jsdom"); const { JSDOM } = jsdom;
    . For what I've understood, this is equivalent to
    const JSDOM = require("jsdom").JSDOM
    . Anyway when trying to use it with kotlin I'm having some issue since
    JSDOM
    is a constructor, but in kotlin is called as a function (and thus it fails with
    Class constructor JSDOM cannot be invoked without 'new'
    . Is it possible to call JSDOM as a constructor in any way? I've tried so many stuff, even using
    js(require(jsdom).JSDOM).window as Window
    but it fails with
    ReferenceError: Window is not defined
    s
    g
    g
    • 4
    • 25
  • a

    ankushg

    10/09/2018, 10:18 PM
    Are there plans for a
    @Keep
    annotation for Kotlin/JS projects that automatically whitelists things from being DCEed? Similar to how Android has
    @Keep
    for ProGuard?
    :youtrack: 2
    g
    b
    • 3
    • 5
  • g

    gbaldeck

    10/10/2018, 3:04 AM
    I'm working on a multiplatform project where I generate the Kotlin/JS files using the DCE with source maps enabled. I then use webpack to pick up those files as modules and bundle them along with my modules in the node_modules directory. The issue I'm having is getting webpack to pick up the kotlin source maps. Anyone know how to do that?
    h
    • 2
    • 8
Powered by Linen
Title
g

gbaldeck

10/10/2018, 3:04 AM
I'm working on a multiplatform project where I generate the Kotlin/JS files using the DCE with source maps enabled. I then use webpack to pick up those files as modules and bundle them along with my modules in the node_modules directory. The issue I'm having is getting webpack to pick up the kotlin source maps. Anyone know how to do that?
Problem solved, I discovered
source-map-loader
👍 2
h

hallvard

10/10/2018, 7:39 AM
This use of webpack and all ... it wouldn't happen to be in a multiplatform project built on a 1.3-rc variant, would it? (I'm strugling to find out how to do this ...)
g

gbaldeck

10/10/2018, 2:44 PM
@hallvard Yeah it is. As of last night my whole project is setup with everything working. Is there something in particular you're having trouble with?
h

hallvard

10/10/2018, 5:13 PM
Nah ... I'm postponing the webpack part. But I get this funny error when doing `gradle publish`:
Invalid publication 'kotlinMultiplatform': groupId cannot be empty.
Funny thing is,
groupId
must be specified allright, because the
jvm
and
js
targets are indeed published to my maven server just before this error occurs ...
g

gbaldeck

10/10/2018, 5:19 PM
Are you working on a multiplatform library?
h

hallvard

10/10/2018, 5:25 PM
Yes, and I am using the newest 1.3-rc stuff permitting to have everything controlled from one gradle spot (i.e. sub-projects
js
and
jvm
defined in the same, top-level gradle file), and mostly, it works like a charm. So it's not a big deal. But that said, I would like
gradle publish
to work properly too ... Do you use the
maven-publish
plugin? Should I define somehow that it is OK not to publish the
common
source set? That's my theory, in fact, that gradle tries to publish stuff from
jsMain
, then from
jvmMain
and finally from
commonMain
... But I don't know where to interrupt this behaviour ...
g

gbaldeck

10/10/2018, 6:56 PM
Maybe someone from JetBrains can help with this, @bashor. I have not published any libraries using the gradle plugin for a long time so I'm not the best person to answer this
View count: 9