Skip to content

Commit

Permalink
fix: only initialise event handlers once
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinEberhardt committed May 13, 2018
1 parent 6c5941d commit 775fe88
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "applause-button",
"description":
"A zero-configuration button for adding applause / claps / kudos to web pages and blog-posts",
"version": "1.0.2",
"version": "1.0.3",
"main": "dist/applause-button.js",
"license": "MIT",
"devDependencies": {
Expand Down
6 changes: 6 additions & 0 deletions client/src/applause-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ const MAX_MULTI_CLAP = 10;

class ApplauseButton extends HTMLCustomElement {
connectedCallback() {
if (this._connected) {
return;
}

this.classList.add("loading");
this.style.display = "block";
// when the color of the button is set via its color property, various
Expand Down Expand Up @@ -122,6 +126,8 @@ class ApplauseButton extends HTMLCustomElement {
this.classList.remove("loading");
this._countElement.innerHTML = Number(claps);
});

this._connected = true;
}

get color() {
Expand Down

0 comments on commit 775fe88

Please sign in to comment.