danysantiago
10/03/2024, 5:46 PMconst myNewInstance = new library.ctorFunction(...)
.
How can I define this in Kotlin WASM with external
? The closest I gotten to is:
external interface Library {
fun ctorFunction(...): JsAny
}
But the glue created does not contain the new
keyword, it is simply: 'org.dany.test.ctorFunction_$external_fun' : (_this, p0, p1, p2) => _this.ctorFunction(p0, p1, p2)
and without the new
the type check of the external function throws a NPE.
It seems the JavaScript glue will only emit a new
keyword if its a Kotlin external class with a constructor, say @JsName("ctorFunction") external class LibInstance constructor(...)
but now I have lost passing the JS object containing the constructor function. The glue code is simply new ctorFunction(...)
where as I need new _this.ctorFunction(...)
like if it was a member external function. Additionally external extension functions are not supported right now.
Any idea on how to do this? Thanks!Robert Jaros
10/03/2024, 7:34 PMjs()
function:
https://pl.kotl.in/8EKPJYxpjdanysantiago
10/03/2024, 11:04 PMjs()
.