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
  • k

    krtko

    03/16/2018, 12:06 AM
    Hello I am porting part of our Android app to JS via the Multiplatform set up. Its pretty awesome but I am having one issue with the expect/actual set up in JS. I am trying to port over my Json Serialization layer. So I created an Expect Json class like:
    expect class Json {
        fun getInt(id: String): Int
    But with JS, the native Json class is only an interface so implementing it like:
    actual class Json: kotlin.js.Json {
        actual fun getInt(id: String): Int {
            return this[id] as? Int ?: 0
        }
    Does not work. Any suggestions?
    w
    g
    • 3
    • 19
  • k

    krtko

    03/16/2018, 6:02 AM
    Can anyone get JSON.parse to work with their actual/expect classes or is it impossible? It doesn’t seem like you can have a cross JVM-JS JSON.
    j
    • 2
    • 2
  • k

    krtko

    03/17/2018, 2:51 AM
    Subclassing XMLHttpRequest?
    class Request(): XMLHttpRequest() {}
    This throws an error because the compiled code doesn’t call the XMLHttpRequest constructor
    g
    b
    • 3
    • 4
  • e

    enleur

    03/17/2018, 11:39 AM
    can i use kotlin/js without gradle?
    w
    c
    • 3
    • 3
  • g

    gbaldeck

    03/17/2018, 3:03 PM
    im going to be using OnsenUI react components in my app, anyone know how to use a 3rd party component like that with the Kotlin react wrapper?
    b
    • 2
    • 1
  • g

    gbaldeck

    03/18/2018, 12:23 AM
    you can't use the dash
    -
    character
    f
    • 2
    • 1
  • a

    Andrew Gein

    03/18/2018, 5:20 AM
    Now I receive error "Could not find org.jetbrains.kotlin-react:16.2.1-pre.19-kotlin-1.2.30:.". Are last semicolon and dot unwanted?
    • 1
    • 1
  • a

    Andrew Gein

    03/19/2018, 6:43 AM
    Okey, one more question. I am trying to convert javascript object to kotlin class. I.e.
    data class Book(val bookId: Int)
    val obj = js("{ bookId: 10 }")
    val book = obj as Book
    Last line fails with
    ClassCastException
    (of course). What is the correct way to do it?
    ☝️ 1
    g
    b
    • 3
    • 2
  • j

    jonathan

    03/19/2018, 10:50 AM
    I'm trying to use https://github.com/lightningtgc/MProgress.js in my KotlinJS project. I'm using
    org.jetbrains.kotlin.frontend
    and have "mprogress" as a
    dependency
    . I've set up this external class:
    external class Mprogress(params: Json) {
        fun start()
        fun end()
        fun set(percent: Double)
        fun inc()
    }
    However, when I try to create a new Mprogress object, it says it can't locate Mprogress' JS definition. How can I make sure it's included?
    g
    • 2
    • 16
  • g

    gaetan

    03/19/2018, 8:47 PM
    @robstoll maybe as dynamic, then:
    val body = document.querySelector("body").asDynamic()
        body.foo = Foo(42)
        println(body.foo)
    r
    • 2
    • 4
  • f

    Fré Dumazy

    03/19/2018, 9:43 PM
    Does anybody know how to access values of
    .env
    in Kotlin (used create-react-kotlin-app with yarn)?
    b
    f
    • 3
    • 3
  • c

    chadmorrow

    03/20/2018, 6:10 PM
    I’ve tried to figure this out on my own to avoid being a bother but can someone give me just a short example of how to use the kotlin-css package to make a stylesheet? I cannot for the life of me figure this out for some reason. @Leonid Khachaturov
    l
    • 2
    • 3
  • j

    jonathan

    03/21/2018, 5:19 AM
    Is there functionality like
    webpack.config.d
    for
    webpack-dev-server-run.js
    , or a way to otherwise manually configure the server for the kotlin frontend gradle plugin?
    v
    b
    • 3
    • 4
  • a

    Andrew Gein

    03/21/2018, 3:46 PM
    Hey, I receive error
    duplicate target file will be created for 'build/node_modules/kotlin-compiler/lib/kotlin-stdlib-js.jar!kotlin.js' and 'build/node_modules/kotlin-compiler/lib/kotlin-jslib.jar!kotlin.js'
    (step
    :runDceKotlinJs'
    ) when trying to build my project on Ubuntu. I can build it on Windows. Kotlin version is 1.2.30. Where can be a problem?
    b
    a
    • 3
    • 12
  • y

    YMobile

    03/22/2018, 9:45 AM
    How to implement Stripe API in Javascript on Firebase cloud server?
    m
    b
    • 3
    • 3
  • s

    spierce7

    03/23/2018, 2:47 PM
    Is there a way to split kotlin-js apps up into multiple bundles?
    b
    c
    • 3
    • 2
  • g

    gbaldeck

    03/23/2018, 3:46 PM
    I am trying to add the "class" attribute to a third party component I imported into my kotlin-react project. How can I do that since "class" is a reserved word and attrs["class"] = "myclass" is not possible since RClass has 'attrs' defined as a function that takes a lambda
    b
    • 2
    • 3
  • c

    chadmorrow

    03/23/2018, 9:22 PM
    Anyone tried using the kotlin-css library for building stylesheets yet? https://github.com/JetBrains/kotlin-wrappers/tree/master/kotlin-css
    b
    • 2
    • 5
  • r

    rCorbellini

    03/24/2018, 2:03 AM
    the grandle build fine, but IDEA still mark as unresolved reference
    b
    • 2
    • 1
  • j

    jacob

    03/24/2018, 10:56 PM
    @danfma is there a reason to use kodando over kotlin-wrappers or vice-versa?
    👍 1
    d
    f
    • 3
    • 6
  • z

    Zomis

    03/25/2018, 1:14 PM
    Has anyone experience of using Kotlin code in JavaScript when building with webpack and npm? That is, I don't want to write JavaScript-code in Kotlin, I want to use my Kotlin-code in JavaScript
    b
    • 2
    • 3
  • z

    Zomis

    03/25/2018, 1:16 PM
    I've setup a project with npm and Vue.JS and when I try to import my code using
    require("path/to/mykotlinlib-js")
    then I get "These dependencies were not found: kotlin in path/to/mykotlinlib.js", and also such an error about klogging as I'm trying to use the KLogging library for Kotlin.
    a
    • 2
    • 1
  • m

    mmaillot

    03/26/2018, 3:20 PM
    Do you know how can I get a JS object with the same proto as plain JS object from a data class (
    Object.getPrototypeOf(input) === Object.prototype
    ) ?
    r
    t
    a
    • 4
    • 11
  • m

    marcinmoskala

    03/26/2018, 6:22 PM
    https://youtrack.jetbrains.com/issue/KT-23449
    c
    b
    s
    • 4
    • 28
  • c

    cubesky

    03/27/2018, 2:40 PM
    When I use Ef.create() ,it return a
    ef.create(str)
    in Javascript. But I want to get a
    new (ef.create(str))()
    , how I can do for this?
    a
    • 2
    • 1
  • m

    mmaillot

    03/27/2018, 3:41 PM
    I wrote an article about uses Kotlin to develop your Firebase Cloud Functions (NodeJS app based on ExpressJS). https://medium.com/@martial.maillot/firebase-with-kotlin-introduction-part-1-of-2-39541a3fa87b Thanks to the team for the help!
    👍 5
    a
    • 2
    • 9
  • g

    gaetan

    03/30/2018, 8:07 AM
    I see this bug still opened. https://youtrack.jetbrains.com/issue/KT-15957 What is the current status of incremental compilation in Kotlin/JS? Is it coming with all the IR work?
    j
    a
    • 3
    • 3
  • g

    Gerard Klijs

    03/30/2018, 9:59 AM
    Maybe you could ‘steal’ some things they changed to clojurescript recently, all the non-project stuff is cashed.
    a
    • 2
    • 1
  • t

    Talon

    03/30/2018, 5:46 PM
    I'm getting an unresolved reference to kotlinx despite everything seeming to be in order?
    a
    • 2
    • 3
  • d

    deviant

    03/30/2018, 9:10 PM
    i'm trying to convert firebase ts declarations with ts2kt lib, and got tons of
    @nativeGetter
    in code which is deprecated and message is: "Use inline extension function with body using dynamic" which i don't fully understand. the code looks like:
    @nativeGetter
        operator fun get(name: String): FirebaseServiceFactory?
        @nativeSetter
        operator fun set(name: String, value: FirebaseServiceFactory)
    g
    a
    b
    • 4
    • 3
Powered by Linen
Title
d

deviant

03/30/2018, 9:10 PM
i'm trying to convert firebase ts declarations with ts2kt lib, and got tons of
@nativeGetter
in code which is deprecated and message is: "Use inline extension function with body using dynamic" which i don't fully understand. the code looks like:
@nativeGetter
    operator fun get(name: String): FirebaseServiceFactory?
    @nativeSetter
    operator fun set(name: String, value: FirebaseServiceFactory)
g

gildor

03/31/2018, 4:49 PM
Maybe something like that:
external inline operator fun MyClass.get(name: String): FirebaseServiceFactory?
Not sure but deprecation warning probably about this case
a

anton.bannykh

04/02/2018, 1:59 PM
I am pretty you should ignore those warnings for now. cc @bashor
b

bashor

04/02/2018, 4:58 PM
@deviant yes, just ignore it now.
View count: 6