JsQualifier

@Target(allowedTargets = [AnnotationTarget.FILE])
annotation class JsQualifier(val value: String)(source)

Adds prefix to external declarations in a source file.

JavaScript does not have concept of packages (namespaces). They are usually emulated by nested objects. The compiler turns references to external declarations either to plain unprefixed names (in case of plain modules) or to plain imports. However, if a JavaScript library provides its declarations in packages, you won't be satisfied with this. You can tell the compiler to generate additional prefix before references to external declarations using the @JsQualifier(...) annotation.

Note that a file marked with the @JsQualifier(...) annotation can't contain non-external declarations.

Example:

@file:JsQualifier("my.jsPackageName")
package some.kotlinPackage

external fun foo(x: Int)

external fun bar(): String

Since Kotlin

1.1

See also

@Target(allowedTargets = [AnnotationTarget.FILE])
annotation class JsQualifier(val value: String)(source)

Adds prefix to external declarations in a source file.

JavaScript does not have concept of packages (namespaces). They are usually emulated by nested objects. The compiler turns references to external declarations either to plain unprefixed names or to plain imports. However, if a JavaScript library provides its declarations in packages, you won't be satisfied with this. You can tell the compiler to generate additional prefix before references to external declarations using the @JsQualifier(...) annotation.

Note that a file marked with the @JsQualifier(...) annotation can't contain non-external declarations.

Example:

@file:JsQualifier("my.jsPackageName")
package some.kotlinPackage

external fun foo(x: Int)

external fun bar(): String

Since Kotlin

1.8

See also

Properties

Link copied to clipboard

the qualifier to add to the declarations in the generated code. It must be a sequence of valid JavaScript identifiers separated by the . character. Examples of valid qualifiers are: foo, bar.Baz, _.$0.f.

Since Kotlin 1.1

the qualifier to add to the declarations in the generated code. It must be a sequence of valid JavaScript identifiers separated by the . character. Examples of valid qualifiers are: foo, bar.Baz, _.$0.f.

Since Kotlin 1.8