@corpecca/qp-web-resources
Version:
Qp web resources
51 lines (39 loc) • 1.45 kB
JavaScript
(function (define) {
define(['toastr', 'qp-web-resources'], function (toastr, qp) {
return (function () {
if (!toastr) {
return;
}
if (!qp) {
return;
}
/* DEFAULTS *************************************************/
toastr.options.positionClass = 'toast-bottom-right';
/* NOTIFICATION *********************************************/
var showNotification = function (type, message, title, options) {
toastr[type](message, title, options);
};
qp.notify.success = function (message, title, options) {
showNotification('success', message, title, options);
};
qp.notify.info = function (message, title, options) {
showNotification('info', message, title, options);
};
qp.notify.warn = function (message, title, options) {
showNotification('warning', message, title, options);
};
qp.notify.error = function (message, title, options) {
showNotification('error', message, title, options);
};
return qp;
})();
});
}(typeof define === 'function' && define.amd
? define
: function (deps, factory) {
if (typeof module !== 'undefined' && module.exports) {
module.exports = factory(require('toastr'), require('qp-web-resources'));
} else {
window.qp = factory(window.toastr, window.qp);
}
}));