#4836 -- Avoid triggering toasts when window is hidden.
This commit is contained in:
parent
f59c524442
commit
fe33d352d1
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue