test filled output dir
This commit is contained in:
parent
ef3377ec7d
commit
fcc1f999f7
3 changed files with 36 additions and 0 deletions
10
public/output/clickable-text.js
Normal file
10
public/output/clickable-text.js
Normal 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>`;
|
||||||
|
}
|
||||||
|
}
|
24
public/output/hello-world.js
Normal file
24
public/output/hello-world.js
Normal 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>`;
|
||||||
|
}
|
||||||
|
}
|
2
public/output/registry.js
Normal file
2
public/output/registry.js
Normal 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]);})
|
Loading…
Reference in a new issue