Soren Valle
08/09/2019, 11:13 AMdiesieben07
08/09/2019, 11:15 AMT::class.js
diesieben07
08/09/2019, 11:15 AMSoren Valle
08/09/2019, 11:18 AMclass Example
fun doSomething(JsClass: dynamic) {
val instance = JsClass() // isn't called with 'new' key word, would like it to be
}
fun main(){
doSomething(Example::class.js)
}
Soren Valle
08/09/2019, 11:19 AMdiesieben07
08/09/2019, 11:19 AMdiesieben07
08/09/2019, 11:20 AMJsClass
or `KClass`:
fun <T : Any> doSomething(cstr: () -> T) {
val instance = cstr()
}
doSomething(::Example)
Soren Valle
08/09/2019, 11:32 AMSoren Valle
08/09/2019, 11:33 AMdiesieben07
08/09/2019, 11:36 AMSoren Valle
08/09/2019, 11:39 AMdiesieben07
08/09/2019, 11:41 AMval instance = js("new myConstructorRef()")
should workSoren Valle
08/09/2019, 11:45 AMdiesieben07
08/09/2019, 11:55 AMdiesieben07
08/09/2019, 11:55 AM