<init>(name: String)
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!")
}
}
© 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/-init-.html