#4836 -- Avoid triggering toasts when window is hidden.

This commit is contained in:
Buster "Silver Eagle" Neece 2021-12-06 19:30:23 -06:00
parent f59c524442
commit fe33d352d1
No known key found for this signature in database
GPG Key ID: F1D2E64A0005E80E
1 changed files with 82 additions and 79 deletions

View File

@ -1,14 +1,17 @@
import Vue
from 'vue';
import { BootstrapVue } from 'bootstrap-vue';
import Vue from 'vue';
import {BootstrapVue} from 'bootstrap-vue';
import 'bootstrap-vue/dist/bootstrap-vue.css';
Vue.use(BootstrapVue);
const BootstrapVueNotifiers = {
install (Vue, opts) {
install(Vue, opts) {
Vue.prototype.$notify = function (message = null, options = {}) {
if (!!document.hidden) {
return;
}
const defaults = {
variant: 'default',
toaster: 'b-toaster-top-right',
@ -16,7 +19,7 @@ const BootstrapVueNotifiers = {
solid: true
};
this.$bvToast.toast(message, { ...defaults, ...options });
this.$bvToast.toast(message, {...defaults, ...options});
};
Vue.prototype.$notifyError = function (message = null, options = {}) {
@ -29,7 +32,7 @@ const BootstrapVueNotifiers = {
title: this.$gettext('Error')
};
this.$notify(message, { ...defaults, ...options });
this.$notify(message, {...defaults, ...options});
return message;
};
@ -44,7 +47,7 @@ const BootstrapVueNotifiers = {
title: this.$gettext('Success')
};
this.$notify(message, { ...defaults, ...options });
this.$notify(message, {...defaults, ...options});
return message;
};
@ -64,7 +67,7 @@ const BootstrapVueNotifiers = {
isStatus: true
};
this.$notify(message, { ...defaults, ...options });
this.$notify(message, {...defaults, ...options});
return message;
};