@Target([AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER]) annotation class JsName
Platform and version requirements: JS
Gives a declaration (a function, a property or a class) specific name in JavaScript.
This may be useful in the following cases:
@JsName(...)
to prevent the compiler from reporting error.@JsName(...)
on functions you want to be available from JavaScript.Example:
class Person(val name: String) {
fun hello() {
println("Hello $name!")
}
@JsName("helloWithGreeting")
fun hello(greeting: String) {
println("$greeting $name!")
}
}
JsName(name: String) Gives a declaration (a function, a property or a class) specific name in JavaScript. |
val name: String the name which compiler uses both for declaration itself and for all references to the declaration. It's required to denote a valid JavaScript identifier. |
© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.js/-js-name/