Skip to content

Commit

Permalink
Triggers events in correct cases to avoid spamming
Browse files Browse the repository at this point in the history
  • Loading branch information
vyzaldysanchez committed Apr 5, 2019
1 parent 4ee1dda commit f5f4ab5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/TimedContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,12 @@ export default {
return moment.tz(this.timezone).isBetween(from, to);
},
toggleContent() {
const wasShown = this.shouldShow;
this.shouldShow = this.shouldShowContent();
if (this.shouldShow) {
if (!wasShown && this.shouldShow) {
this.$emit("show");
} else {
} else if (wasShown && !this.shouldShow) {
this.$emit("hide");
}
}
Expand Down

0 comments on commit f5f4ab5

Please sign in to comment.