No string functions in simple js project


#1

Hi All

I was trying to play around with kotlin as a JS frontend. I created a small html page which loads:

resources/js/kotlinEcma3.js
resources/js/js-engine.js

the second being the output of my kotlin program:

fun main(args: Array<String>) {   jq {   val title = jq("html head title")   title.text("test")   jq("div#uri").text(window.document.baseURI)   var iep = -1   for(ci in 0..window.document.baseURI.length() ) {            val c =  window.document.baseURI[ci]            if(c == '/') iep = ci;   }   jq("div#base").text("${iep}")   val base = window.document.baseURI.substring(0, iep)

  &nbsp;&nbsp;jq("div#base").text("${iep} " + base)

  }
}


the jq part works fine, but trying to use lastIndexOf or iterating fails, because length() or lastIndexOf() are not found. Do I need to import some additional js code?

Kind Regards
  Sasa

P.S.: i am really impressed by kotlin. kudos jetbrains


#2

Hello!

Thank you for your kind words.

Could you please specify the version of plugin you are using and attach the whole project?

You can also file bugs via http://youtrack.jetbrains.com/issues/KT

Thanks!


#3

version is: 0.5.748

project enclosed



svd-kt-html.zip (1.39 MB)

#4

after repeatedly adding and removing the KotlinJavaScript runtime both from the module dependencies and artifact output i got it finally working.