summaryrefslogtreecommitdiff
path: root/examples/framework-lit/src/components/Counter.js
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@matthewphillips.info> 2021-07-13 08:27:40 -0400
committerGravatar GitHub <noreply@github.com> 2021-07-13 08:27:40 -0400
commit48851c9d256b78c8e99e72d91ed98209a6a99e93 (patch)
tree19b4f4b293d4b569851a2d2531187415e13137d1 /examples/framework-lit/src/components/Counter.js
parent1b13f5c158b5fbe157406308205c0939b415e1d7 (diff)
downloadastro-48851c9d256b78c8e99e72d91ed98209a6a99e93.tar.gz
astro-48851c9d256b78c8e99e72d91ed98209a6a99e93.tar.zst
astro-48851c9d256b78c8e99e72d91ed98209a6a99e93.zip
Adds support for a Lit renderer (#665)
* Adds support for a Lit renderer This adds `@astrojs/renderer-lit`. An experimental Lit renderer. * Removed cached submodule, mistake * Prevent globals clobbering * Add docs on globals
Diffstat (limited to 'examples/framework-lit/src/components/Counter.js')
-rw-r--r--examples/framework-lit/src/components/Counter.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/examples/framework-lit/src/components/Counter.js b/examples/framework-lit/src/components/Counter.js
new file mode 100644
index 000000000..c901096d5
--- /dev/null
+++ b/examples/framework-lit/src/components/Counter.js
@@ -0,0 +1,34 @@
+import { LitElement, html } from 'lit';
+
+export const tagName = 'my-counter';
+
+class Counter extends LitElement {
+ static get properties() {
+ return {
+ count: {
+ type: Number
+ }
+ };
+ }
+
+ constructor() {
+ super();
+ this.count = 0;
+ }
+
+ increment() {
+ this.count++;
+ }
+
+ render() {
+ return html`
+ <div>
+ <p>Count: ${this.count}</p>
+
+ <button type="button" @click=${this.increment}>Increment</button>
+ </div>
+ `;
+ }
+}
+
+customElements.define(tagName, Counter); \ No newline at end of file