kotlin.js.JsNonModule

JsNonModule

@Target([AnnotationTarget.CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.FILE]) annotation class JsNonModule

Platform and version requirements: JS

Denotes an external declaration that can be used without module system.

By default, an external declaration is available regardless your target module system. However, by applying JsModule annotation you can make a declaration unavailable to plain module system. Some JavaScript libraries are distributed both as a standalone downloadable piece of JavaScript and as a module available as an npm package. To tell the Kotlin compiler to accept both cases, you can augment JsModule with the @JsNonModule annotation.

For example:

@JsModule("jquery")
@JsNonModule
@JsName("$")
external abstract class JQuery() {
    // some declarations here
}

@JsModule("jquery")
@JsNonModule
@JsName("$")
external fun JQuery(element: Element): JQuery

See Also

JsModule

Since 1.1

Constructors

<init>

JsNonModule()

Denotes an external declaration that can be used without module system.

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

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部