Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kotlin: What is a kjsm file?

I have been trying to use the Kotlin -> js compiler by following this tutorial.

When I run kotlinc-js --help, then the help text mentions the following:

-kjsm    Generate kjsm-files (for creating libraries)

What is a kjsm file?

like image 387
ismail Avatar asked Dec 21 '16 18:12

ismail


1 Answers

A kjsm-file is a Kotlin JavaScript Meta file (see KotlinJavaScriptMetaFileType).

Such a file appears to be used to provide meta data for native JavaScript objects so that the Kotlin compiler can type-check things and so that an IDE can provide code completion, etc. e.g. If you look in kotlin-js-library-1.0.6.jar you will find, among other kjsm-files, a Window.kjsm file which defines the Window Web API available in web browsers.

You would want to generate your own kjsm-files whenever you are creating a library so that your interfaces can be used by the compiler/IDE in modules which depend on your Kotlin JavaScript library.

like image 85
mfulton26 Avatar answered Nov 02 '22 02:11

mfulton26