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

    joris

    01/25/2017, 1:47 PM
    val myMap = mutableMapOf<String, String>()
    myMap["content-type"] = "application/json"
    myMap["content-length"] = "50"
    
    myMap.toPlainJSObject()//Put your transform logic here
    b
    a
    • 3
    • 6
  • u

    uli

    01/31/2017, 9:56 PM
    Hi, is there any documentation about the content of the*.meta.js files?
    b
    • 2
    • 4
  • a

    aimozg

    02/03/2017, 1:44 AM
    I'm an idiot
    h
    b
    • 3
    • 6
  • d

    danfma

    02/06/2017, 7:27 PM
    After updating my IDE and the project, the IDE can’t compile anymore, but the project is compiling normally with maven (in more than 22s which is not exactly viable).
    b
    • 2
    • 8
  • t

    turansky

    02/06/2017, 7:28 PM
    Is it possible to realize (possibly with hacks) trait logic in last KotlinJS? In my case I have logic:
    interface A {
       fun doOne() // must be overrided
       fun doTwo() = definedExternally
    }
    
    class B: A {
       override fun doOne() { // do something  }
    
    class C: A {
       override fun doOne() { // do something }
    }
    b
    a
    k
    • 4
    • 80
  • d

    dnguyenminh

    02/07/2017, 5:58 PM
    [ERROR] D:\projects\kotlin\learnjs\src\main\kotlin\com\collokia\browserplugin\chrome\GoogleImageTest\Extension.kt:[4,20] Unresolved reference: HTMLImageElement
    [ERROR] D:\projects\kotlin\learnjs\src\main\kotlin\com\collokia\browserplugin\chrome\GoogleImageTest\Extension.kt:[5,15] Unresolved reference: browser
    [ERROR] D:\projects\kotlin\learnjs\src\main\kotlin\com\collokia\browserplugin\chrome\GoogleImageTest\Extension.kt:[13,9] Unresolved reference: js
    b
    • 2
    • 1
  • t

    turansky

    02/13/2017, 5:50 AM
    @danfma: I understand, that described scheme works very well. I only want to know if this scheme is standard for KotlinJS.
    b
    • 2
    • 1
  • j

    janvladimirmostert

    02/14/2017, 9:40 AM
    @louiscad If treeshaking is an absolute dealbreaker for you and writing JS by hand is not an option, there's always Dart Dart has treeshaking at the moment
    👍 1
    l
    • 2
    • 6
  • t

    turansky

    02/18/2017, 10:15 AM
    How to write wrappers, when I have no information about nullability of function parameters and result ?
    b
    • 2
    • 6
  • a

    adeln

    02/23/2017, 12:43 PM
    how do I use
    definedExternally
    in my project?
    👍 1
    b
    • 2
    • 4
  • a

    aimozg

    02/23/2017, 8:41 PM
    How do I
    external val String.Companion.fromCharCode: Function<String> = definedExternally
    ?
    b
    • 2
    • 1
  • a

    aimozg

    02/23/2017, 8:50 PM
    I need to convert
    TypedArray
    with UTF-8 bytes to
    String
    , and JS solution is
    decodeURIComponent(escape(String.fromCharCode.apply(null, typedArray)))
    (or not-so-supported
    new TextDecoder().decode(typedArray)
    )
    b
    • 2
    • 1
  • t

    Tristan Caron

    02/28/2017, 11:10 AM
    @bashor I'm having some trouble with ts2kt
    b
    • 2
    • 1
  • d

    danfma

    03/02/2017, 1:06 AM
    The project above is in https://github.com/danfma/kodando. It compiles with Maven but doesn't with IDEA.
    b
    • 2
    • 3
  • j

    jcogilvie

    03/02/2017, 6:45 PM
    @bashor @irus @pabl0rg https://youtrack.jetbrains.com/issue/KT-16604
    👍 4
    b
    • 2
    • 1
  • a

    alexander.egger

    03/03/2017, 7:18 AM
    Hi, I think I found a KotlinJS compiler bug. I know I should report this via YouTrack (and I will) but I just wanted to double check here: class ProducesUninitializedTmpVarInJs(private val bar: (idx: Int) -> Boolean) { private var idx = 0 fun foo(): Boolean = true && bar(idx++) } /* ProducesUninitializedTmpVarInJs.prototype.foo = function () { var tmp$, tmp$_0, tmp$_1, tmp$_2; tmp$_2 = tmp$_1(tmp$_0); // tmp$1 is 'undefined' at this place!!! if (true) { tmp$_1 = this.bar_0; tmp$_0 = (tmp$ = this.idx_0, this.idx_0 = tmp$ + 1 | 0, tmp$); } else tmp$_2 = false; return tmp$_2; }; */ As you can see tmp$1 is ‘undefined’!
    b
    • 2
    • 3
  • a

    alexander.egger

    03/03/2017, 10:01 AM
    Once more not sure if this is a bug or if I am using it wrong val chars = charArrayOf('a', 'b', 'c') chars.iterator().forEach(::println) prints “97 98 99” for (char in chars) println(char) prints “a b c”
    a
    • 2
    • 3
  • k

    k.schmaranz

    03/03/2017, 12:53 PM
    Bug or Feature? Let's consider this piece of code: val foo = ByteArray(2, { 99.toByte() }) println("is it a ByteArray? -> ${foo is ByteArray}") ... this gives false, which I would consider quite unexpected but println("is it an Array? -> ${foo is Array<*>}") gives true So, besides the fact that I can definitely understand that the special XXXArray types are not everyone's favourites, could you please comment, whether the "wrong" type is a bug or whether it is a feature that will stay in there.. Thanks!
    b
    • 2
    • 1
  • n

    nimakro

    03/07/2017, 9:39 PM
    Hey guys I was wondering if you guys know if there is a project out there that is targeted to build single page web applications, like angularJs but written in kotlin since it can compile 100% to javascript
    j
    • 2
    • 2
  • k

    konsoletyper

    03/08/2017, 8:30 AM
    It's not GWT that failed. It's Google that simple thrown away GWT. My experience with GWT was good, I liked this way of writing apps
    l
    • 2
    • 1
  • a

    apomelov

    03/09/2017, 2:01 PM
    @alex framework free is not so interesting. As I wrote before, it will not attract people until they don’t able to use their favourite frameworks. Would you use Kotlin if it hadn’t java interop?)
    k
    s
    • 3
    • 16
  • r

    Roman Ivanov

    03/10/2017, 4:11 AM
    @danfma Is there any simple example for React?
    c
    • 2
    • 1
  • m

    melatonina

    03/10/2017, 4:54 PM
    I had to close the project and re-open it. IDEA asked me if I wanted to "import the gradle projects", I imported all of them. Then I had to replace classpath "com.moowork.gradle:gradle-node-plugin:0.12" with the code found here: https://plugins.gradle.org/plugin/com.moowork.node (I used the Gradle 2.1 code plugins { id "com.moowork.node" version "1.1.1" }). Re-syncing Gradle I had "Cannot add extension with name 'kotlin', as there is an extension already registered with that name." errors in several places like "apply plugin: 'kotlin'" or similar lines.
    b
    a
    • 3
    • 17
  • d

    danfma

    03/15/2017, 2:51 PM
    hey guys, I'm trying to use gradle but I'm losing the fight... 😄 how can I extract the dependencies into a repository (I want to unpack the external libraries)
    b
    • 2
    • 2
  • g

    gaetan

    03/16/2017, 8:50 PM
    In terms of performance, do you expect the JS compiler to become more or less equal to the JVM one?
    s
    k
    • 3
    • 6
  • b

    billy.parrish

    03/16/2017, 9:35 PM
    Would the kotlin - javascript functionality be relevant for creating Firebase cloud functions? Has anyone tried to this out yet? https://firebase.google.com/docs/functions/
    m
    • 2
    • 2
  • t

    turansky

    03/18/2017, 3:27 PM
    Is any possibility read some fields as enum values when I use
    JSON.parse()
    ? For example:
    // JSON
    {
        name: “Machine #1”
        status: 1 // possible values 1,2,3,4
    }
    
    // Data class
    data class Data(val name: String, val status: Status)
    
    enum class Status {
        NORMAL(1),
        DISABLED(2),
        ....
    }
    
    // read code
    JSON.parse<Data>(source)
    b
    • 2
    • 4
  • m

    melatonina

    03/18/2017, 7:05 PM
    Is there a list of transpilation options?
    • 1
    • 1
  • m

    melatonina

    03/18/2017, 7:58 PM
    copyKotlinJs
    a transpilation option? I found it here: https://github.com/abesto/gradle-kotlin-js-example/blob/master/build.gradle but I can't manage to make it work.
    • 1
    • 1
  • j

    jean

    03/19/2017, 1:26 PM
    Does anybody knows how to setup Idea to debug Kotlin JS code when running an app in local HTTP server? I check "Generate source maps", create Javascript debug Debug configuraton. But generated MyApp.js.map contains path to local file system. Neither Chrome neither Idea stop on the breakpoint.
    b
    • 2
    • 2
Powered by Linen
Title
j

jean

03/19/2017, 1:26 PM
Does anybody knows how to setup Idea to debug Kotlin JS code when running an app in local HTTP server? I check "Generate source maps", create Javascript debug Debug configuraton. But generated MyApp.js.map contains path to local file system. Neither Chrome neither Idea stop on the breakpoint.
b

bashor

03/20/2017, 11:36 AM
AFAIK https://github.com/Kotlin/kotlin-frontend-plugin just overwrite paths for that
and feel free to star or vote the issue to get updates https://youtrack.jetbrains.com/issue/KT-4078
View count: 3