-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
Hi Ben,
I did not expect listing 5.7 to work, because in strings.js we are not registering the component WebHarpString. We are importing WebHarpString
import WebHarpString from "../string/string.js";but we are not registering it
customElements.define('webharp-string', WebHarpString);Instead it works! How?
For example, when in index.html we run
<script type="module" src="./components/app/app.js"></script>we are "importing" the entire app.js code, which include the registration of the WebHarpApp component,
customElements.define("webharp-app", WebHarpApp);so, in index.html I would expect
<webharp-app strings="8"></webharp-app>to work just fine. While the code in strings.js so far for me, it's magic
PS: not important: in app.js I don't think we need to export default the class WebHarpApp
export default class WebHarpApp extends HTMLElement { //...since with the script tag in index.html
<script type="module" src="./components/app/app.js"></script>we are taking in the entire module, right?
Metadata
Metadata
Assignees
Labels
No labels