summaryrefslogtreecommitdiff
path: root/src/main/resources
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2020-01-22 16:54:49 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2020-01-22 16:54:49 +0100
commitffd96bb29112463e415c1cd476de658aa7963934 (patch)
treeee2af76d1dd700914eef7c53e21be7de77fb9995 /src/main/resources
parent41a8ae6e38deb3b08b4014e06e03c189809d8747 (diff)
WebComponents: Use lit-html for templating.
Change-Id: Ic2fac595c5fc0275a4859d8c8bf470c77907be19
Diffstat (limited to 'src/main/resources')
-rw-r--r--src/main/resources/META-INF/resources/admin/AdminElement.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main/resources/META-INF/resources/admin/AdminElement.js b/src/main/resources/META-INF/resources/admin/AdminElement.js
index 8398d55..7c4e8e8 100644
--- a/src/main/resources/META-INF/resources/admin/AdminElement.js
+++ b/src/main/resources/META-INF/resources/admin/AdminElement.js
@@ -27,12 +27,11 @@ export class AdminElement extends HTMLElement {
render() {
let greetee = this.getAttribute("greetee");
- const template = `
- <p>Hello ${greetee}! <button id="switch">Switch</button></p>
+ const template = html`
+ <p>Hello ${greetee}! <button @click=${this.onSwitchClicked}>Switch</button></p>
`;
- this.shadowRoot.innerHTML = template;
- this.shadowRoot.querySelector('#switch').addEventListener('click', this.onSwitchClicked);
+ render(template, this.shadowRoot);
}
}