Hello, I'm trying to translate `window.customEleme...
# javascript
y
Hello, I'm trying to translate
window.customElements.define('app-drawer', class extends HTMLElement {})
in kolin. I've tried
window.customElements.define("app-drawer", { js("class extends HTMLElement {}")})
, but it seems that the compiler try to analyse the
js("...")
content and don't understand the declaration.
r
Hi Yann,
js("...")
function takes only ES5 code when
class extends
is ES6 syntax
You always could create an object like
Copy code
window.customElements.define("app-drawer",  object: HTMLElement() {
 ... 
})
y
Thanks. It's quite unconvenient as there a lot to "implements" (with definedExternally). There is no way to specify the target js version (and so the JS version allowed in
js("...")
) ?
r
Currently Kotlin/JS target version is ES5 so since
js()
is inlined into resulted js code it also should be ES5. We are now working hard to support different ES versions.
y
Ok, it's clear. Thanks for the answers :)
r
You're welcome