I want to use Kotlin to generate some JavaScript like following:
function MyComponent() {
self.constructor = function() {}
}
The problem is constructor is a keyword in Kotlin, I can't just write like:
class MyComponent {
fun constructor() {}
}
I also tried:
class MyComponent {
@JsName("constructor")
fun ctor() {}
}
It still report errors like:
JavaScript name generated for this declaration clashes
with built-in declaration {1}
How to generate a javascript function which has name constructor?
constructorname is required by the js lib used with kotlin, can't be changedkotlinpersonally, I've been meaning to, however, I've never actually used it, JS on the other hand... have you tried something likewindow["constructor"]within your JS? I'm not sure if that would work or not...