- From: Joe Pea <notifications@github.com>
- Date: Fri, 10 Jul 2020 10:23:57 -0700
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/webcomponents/issues/884@github.com>
In the following,
```js
<definition name="my-element">
<template>....</template>
<script type="module">
class MyElement extends HTMLElement {
#template;
constructor(state, ...args) {
super(state, ...args);
#template = customElements.attachTemplateAsShadow(this, state);
}
render(state) {
#template.update(state);
}
}
</script>
</definition>
```
how does the engine know to define the `<my-element>` element using the `MyElement` class?
How does `type="module"` come into play here? What happens if type=module were not included?
What happens if I write two classes in the script tag? F.e.
```js
<definition name="my-element">
<template>....</template>
<script type="module">
class MyElement extends HTMLElement {
// ...
}
class MyOtherElement extends HTMLElement {
// ...
}
</script>
</definition>
```
Or is the example in the proposal missing an `export`? Should it be
```js
<definition name="my-element">
<template>....</template>
<script type="module">
export default class MyElement extends HTMLElement {
// ...
}
</script>
</definition>
```
?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/884
Received on Friday, 10 July 2020 17:24:10 UTC