@Target([AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER]) annotation class JsName
Gives a declaration (a function, a property or a class) specific name in JavaScript.
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!")
}
}
Gives a declaration (a function, a property or a class) specific name in JavaScript.
<init>(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.
val name: String
© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.js/-js-name/index.html