test filled output dir

This commit is contained in:
Ayo 2023-10-08 09:21:45 +02:00
parent ef3377ec7d
commit fcc1f999f7
3 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,10 @@
import WebComponent from "https://unpkg.com/web-component-base/index.js";
export default class ClickableText extends WebComponent {
onInit() {
this.onclick = () => alert("Thank you for clicking the text!");
}
get template() {
return `<span style="cursor:pointer">Click me too!</span>`;
}
}

View file

@ -0,0 +1,24 @@
import WebComponent from "https://unpkg.com/web-component-base/index.js";
export default class HelloWorld extends WebComponent {
name = "";
static properties = ["name"];
onInit() {
console.log(`Greeting for ${this.name} initialized`);
let count = 0;
this.onclick = () => {
console.log("Clicked!");
this.setAttribute("name", `I was clicked ${++count} times`);
};
this.setAttribute("title", "Click me please");
}
onChanges(changes) {
console.log(changes);
}
get template() {
return `<button style="cursor:pointer">Hello ${this.name}!</button>`;
}
}

View file

@ -0,0 +1,2 @@
import C0 from "./clickable-text.js";import C1 from "./hello-world.js";const registry = {
"clickable-text": C0,"hello-world": C1};Object.keys(registry).forEach((key) => {if(window?.hasOwnProperty("customElements"))customElements.define(key, registry[key]);})