feat: update code example
This commit is contained in:
parent
55c83e6d86
commit
4259ea51cd
1 changed files with 1 additions and 1 deletions
|
@ -32,7 +32,7 @@ Let's consider the following code example (also [in CodePen →](https://code
|
||||||
class Counter extends HTMLElement {
|
class Counter extends HTMLElement {
|
||||||
static observedAttributes = ["data-count"];
|
static observedAttributes = ["data-count"];
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
this.dataset.count = this.getAttribute('data-count') ?? 0;
|
this.dataset.count = 0;
|
||||||
this.onclick = () => ++this.dataset.count;
|
this.onclick = () => ++this.dataset.count;
|
||||||
}
|
}
|
||||||
attributeChangedCallback(prop, oldValue, newValue) {
|
attributeChangedCallback(prop, oldValue, newValue) {
|
||||||
|
|
Loading…
Reference in a new issue