JsExport

Exports top-level declaration on JS platform.

Compiled module exposes declarations that are marked with this annotation without name mangling.

This annotation can be applied to either files or top-level declarations.

It is currently prohibited to export the following kinds of declarations:

  • expect declarations

  • inline functions with reified type parameters

  • suspend functions

  • secondary constructors without @JsName

  • extension properties

  • enum classes

  • annotation classes

Signatures of exported declarations must only contain "exportable" types:

  • dynamic, Any, String, Boolean, Byte, Short, Int, Float, Double

  • BooleanArray, ByteArray, ShortArray, IntArray, FloatArray, DoubleArray

  • Array<exportable-type>

  • Function types with exportable parameters and return types

  • external or @JsExport classes and interfaces

  • Nullable counterparts of types above

  • Unit return type. Must not be nullable

This annotation is experimental, meaning that restrictions mentioned above are subject to change.

Since Kotlin

1.4

Exports top-level declaration on JS platform.

Compiled module exposes declarations that are marked with this annotation without name mangling.

This annotation can be applied to either files or top-level declarations.

It is currently prohibited to export the following kinds of declarations:

  • expect declarations

  • inline functions with reified type parameters

  • suspend functions

  • secondary constructors without @JsName

  • extension properties

  • enum classes

  • annotation classes

Signatures of exported declarations must only contain "exportable" types:

  • dynamic, Any, String, Boolean, Byte, Short, Int, Float, Double

  • BooleanArray, ByteArray, ShortArray, IntArray, FloatArray, DoubleArray

  • Array<exportable-type>

  • Function types with exportable parameters and return types

  • external or @JsExport classes and interfaces

  • Nullable counterparts of types above

  • Unit return type. Must not be nullable

This annotation is experimental, meaning that restrictions mentioned above are subject to change.

Since Kotlin

1.3
actual annotation class JsExport(source)

Exports top-level declaration on JS platform.

Can only be applied to top-level functions.

Since Kotlin

1.8

Types

Link copied to clipboard

This annotation indicates that the exported declaration should be exported as default on the JS platform.

Since Kotlin 2.3

This annotation indicates that the exported declaration should be exported as default on the JS platform.

Since Kotlin 2.3

This annotation indicates that the exported declaration should be exported as default on the JS platform.

Since Kotlin 2.3
Link copied to clipboard

This annotation prevents the annotated member of an exported class from being exported. It is experimental, meaning the restrictions described above are subject to change.

Since Kotlin 1.8

The annotation prevents exporting the annotated member of an exported class. This annotation is experimental, meaning that the restrictions mentioned above are subject to change.

Since Kotlin 1.8