Skip to content

KotlinJS

Ruby Lichtenshtein edited this page Nov 7, 2018 · 4 revisions

KotlinJS

  • Kotlin provides the ability to target JavaScript. It does so by transpiling Kotlin to JavaScript. The current implementation targets ECMAScript 5.1 but there are plans to eventually target ECMAScript 2015 as well.

  • this excludes the JDK and any JVM or Java framework or library used.

Client-side JS

  • Interacting with DOM elements. Kotlin provides a series of statically typed interfaces to interact with the Document Object Model, allowing creation and update of DOM elements.

  • Interacting with graphics such as WebGL. You can use Kotlin to create graphical elements on a web page using WebGL.

Server-side JS

  • Working with server-side technology. You can use Kotlin to interact with server-side JavaScript such as Node.js you can convert TypeScript definitions from the Definitely Typed type definitions repository to Kotlin using the ts2kt tool. Alternatively, you can use the dynamic type to access any framework without strong typing.
  • Converter of TypeScript definition files to Kotlin declarations
  • Being a statically typed language, Kotlin still has to interoperate with untyped or loosely typed environments, such as the JavaScript ecosystem. To facilitate these use cases, the dynamic type is available in the language.

KotlinJS Interop.

Calling JavaScript from Kotlin.

Calling Kotlin from JavaScript.

  • Representing Kotlin types in JavaScript.
  • @JsName annotation.

Testing

  • Multiplatform motivation

  • Kotlin targets

    • KotlinJS

      • Client-side JS
      • Server-side JS
      • KotlinJS Interop.
      • Testing.
    • Kotlin Native

      • Why Kotlin/Native?
      • Target Platforms
      • Testing.
  • Kotlin Multiplatform

    • Platform-Specific Declarations - expected/actual mechanism
    • Common module.
    • Architecture.
    • Testing.
Clone this wiki locally