Examining the compilation output

The kotlin.js and kotlinx-html-js.js files are nothing but the Kotlin output files. It's not compilation output, but actually transpiled output. The following are output compilations: 

  • kotlin.js: This is the runtime and standard library. It doesn't change between applications, and it's tied to the version of Kotlin being used.
  • {module}.js: This is the actual code from the application. All files are compiled into a single JavaScript file that has the same name as the module.
  • {file}.meta.js: This metafile will be used for reflection and other functionalities.

Let's assume our final Main.kt file will look like this: 

    fun main(args: Array<String>) {      val socket: dynamic = js("window.socket")      val chatWindow = ...

Get Kotlin Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.