kotlin.js.JsQualifier.<init>

<init>

JsQualifier(value: String)

Platform and version requirements: JS

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 @JsQuafier(...) annotation.

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

Example:

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

external fun foo(x: Int)

external fun bar(): String

© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.js/-js-qualifier/-init-.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部