From f5f4ab5690cff161351cf43424ca295bd86e26aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vyzaldy=20Andr=C3=A9s=20Sanchez?= Date: Fri, 5 Apr 2019 18:31:30 -0400 Subject: [PATCH] Triggers events in correct cases to avoid spamming --- src/components/TimedContent.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/TimedContent.vue b/src/components/TimedContent.vue index 91d7d23..4470c87 100644 --- a/src/components/TimedContent.vue +++ b/src/components/TimedContent.vue @@ -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"); } }