photoprism/frontend/src/common/notify.js
Michael Mayer 4421e7d203 Add simple file browser to Library #260
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-05-24 22:16:06 +02:00

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;