4421e7d203
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
import Event from "pubsub-js";
|
|
|
|
const Notify = {
|
|
info: function (message) {
|
|
Event.publish("notify.info", {msg: message});
|
|
},
|
|
warn: function (message) {
|
|
Event.publish("notify.warning", {msg: message});
|
|
},
|
|
error: function (message) {
|
|
Event.publish("notify.error", {msg: message});
|
|
},
|
|
success: function (message) {
|
|
Event.publish("notify.success", {msg: message});
|
|
},
|
|
logout: function (message) {
|
|
Event.publish("notify.error", {msg: message});
|
|
Event.publish("session.logout", {msg: message});
|
|
},
|
|
ajaxStart: function() {
|
|
Event.publish("ajax.start");
|
|
},
|
|
ajaxEnd: function() {
|
|
Event.publish("ajax.end");
|
|
},
|
|
blockUI: function() {
|
|
const el = document.getElementById("p-busy-overlay");
|
|
|
|
if(el) {
|
|
el.style.display = "block";
|
|
}
|
|
},
|
|
unblockUI: function() {
|
|
const el = document.getElementById("p-busy-overlay");
|
|
|
|
if(el) {
|
|
el.style.display = "none";
|
|
}
|
|
},
|
|
wait: function () {
|
|
this.warn("Busy, please wait...");
|
|
},
|
|
};
|
|
|
|
export default Notify;
|