Linted
This commit is contained in:
parent
ee1d8f3c8a
commit
48deb375cb
|
@ -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()
|
||||
},
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
},
|
||||
})
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue