diff --git a/src/renderer/components/ft-share-button/ft-share-button.js b/src/renderer/components/ft-share-button/ft-share-button.js index 5d86f872..cc897cd7 100644 --- a/src/renderer/components/ft-share-button/ft-share-button.js +++ b/src/renderer/components/ft-share-button/ft-share-button.js @@ -60,7 +60,7 @@ export default Vue.extend({ }, copyInvidious() { - FtToastEvents.$emit('toast.open', "Invidious URL copied to clipboard") + FtToastEvents.$emit('toast.open', 'Invidious URL copied to clipboard') this.copy(this.invidiousURL) this.$refs.iconButton.toggleDropdown() }, @@ -71,7 +71,7 @@ export default Vue.extend({ }, copyYoutube() { - FtToastEvents.$emit('toast.open', "YouTube URL copied to clipboard") + FtToastEvents.$emit('toast.open', 'YouTube URL copied to clipboard') this.copy(this.youtubeURL) this.$refs.iconButton.toggleDropdown() }, @@ -82,7 +82,7 @@ export default Vue.extend({ }, copyYoutubeEmbed() { - FtToastEvents.$emit('toast.open', "YouTube Embed URL copied to clipboard") + FtToastEvents.$emit('toast.open', 'YouTube Embed URL copied to clipboard') this.copy(this.youtubeEmbedURL) this.$refs.iconButton.toggleDropdown() }, @@ -93,7 +93,7 @@ export default Vue.extend({ }, copyInvidiousEmbed() { - FtToastEvents.$emit('toast.open', "Invidious Embed URL copied to clipboard") + FtToastEvents.$emit('toast.open', 'Invidious Embed URL copied to clipboard') this.copy(this.invidiousEmbedURL) this.$refs.iconButton.toggleDropdown() }, diff --git a/src/renderer/components/ft-toast/ft-toast-events.js b/src/renderer/components/ft-toast/ft-toast-events.js index 657c8034..c32b0e13 100644 --- a/src/renderer/components/ft-toast/ft-toast-events.js +++ b/src/renderer/components/ft-toast/ft-toast-events.js @@ -1,4 +1,4 @@ -import Vue from 'vue'; +import Vue from 'vue' -const events = new Vue(); -export default events; \ No newline at end of file +const events = new Vue() +export default events diff --git a/src/renderer/components/ft-toast/ft-toast.js b/src/renderer/components/ft-toast/ft-toast.js index d8ea4487..adcec349 100644 --- a/src/renderer/components/ft-toast/ft-toast.js +++ b/src/renderer/components/ft-toast/ft-toast.js @@ -6,11 +6,11 @@ export default Vue.extend({ data: function () { return { toasts: [ - {isOpen: false, message: '', action: null, timeout: null}, - {isOpen: false, message: '', action: null, timeout: null}, - {isOpen: false, message: '', action: null, timeout: null}, - {isOpen: false, message: '', action: null, timeout: null}, - {isOpen: false, message: '', action: null, timeout: null} + { isOpen: false, message: '', action: null, timeout: null }, + { isOpen: false, message: '', action: null, timeout: null }, + { isOpen: false, message: '', action: null, timeout: null }, + { isOpen: false, message: '', action: null, timeout: null }, + { isOpen: false, message: '', action: null, timeout: null } ], queue: [], } @@ -18,21 +18,24 @@ export default Vue.extend({ mounted: function () { FtToastEvents.$on('toast.open', this.open) }, + beforeDestroy: function () { + FtToastEvents.$off('toast.open', this.open) + }, methods: { performAction: function (toast) { toast.action() this.close(toast) }, close: function (toast) { - clearTimeout(toast.timeout); + clearTimeout(toast.timeout) toast.isOpen = false - if(this.queue.length !== 0) { + if (this.queue.length !== 0) { const nexToast = this.queue.shift() this.open(nexToast.message, nexToast.action) } }, open: function (message, action) { - for(let i = this.toasts.length - 1; i >= 0 ; i--){ + for (let i = this.toasts.length - 1; i >= 0; i--) { const toast = this.toasts[i] if (!toast.isOpen) { return this.showToast(message, action, toast) @@ -47,7 +50,4 @@ export default Vue.extend({ toast.timeout = setTimeout(this.close, 2000, toast) } }, - beforeDestroy: function () { - FtToastEvents.$off('toast.open', this.open) - }, }) diff --git a/src/renderer/components/ft-toast/ft-toast.vue b/src/renderer/components/ft-toast/ft-toast.vue index 5159cf9e..fd7cf3c6 100644 --- a/src/renderer/components/ft-toast/ft-toast.vue +++ b/src/renderer/components/ft-toast/ft-toast.vue @@ -7,10 +7,12 @@ :class="{ closed: !toast.isOpen, open: toast.isOpen }" @click="performAction(toast)" > -
+ - \ No newline at end of file +