This commit is contained in:
kyle.watson 2020-06-27 16:27:03 +01:00
parent ee1d8f3c8a
commit 48deb375cb
4 changed files with 22 additions and 20 deletions

View File

@ -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()
},

View File

@ -1,4 +1,4 @@
import Vue from 'vue';
import Vue from 'vue'
const events = new Vue();
export default events;
const events = new Vue()
export default events

View File

@ -18,13 +18,16 @@ 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) {
const nexToast = this.queue.shift()
@ -47,7 +50,4 @@ export default Vue.extend({
toast.timeout = setTimeout(this.close, 2000, toast)
}
},
beforeDestroy: function () {
FtToastEvents.$off('toast.open', this.open)
},
})

View File

@ -7,7 +7,9 @@
:class="{ closed: !toast.isOpen, open: toast.isOpen }"
@click="performAction(toast)"
>
<p class="message">{{ toast.message }}</p>
<p class="message">
{{ toast.message }}
</p>
</div>
</div>
</template>