Moisés de Jesús Cortés Castellanos 24edbfebb4
ADD: Notificaciones en tiempo real (#3)
* ADD: Avances
* ADD: Usuarios conectados en tiempo real
2024-12-27 12:10:10 -06:00

66 lines
1.2 KiB
JavaScript

import toastr from 'toastr';
class Notify {
constructor() {}
flash({message = 'Successful registration', type = 'success', timeout = 5, title= Lang('notification')}) {
toastr.options = {
"closeButton": true,
"debug": false,
"newestOnTop": false,
"progressBar": true,
"positionClass": "toast-bottom-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": timeout * 1000,
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
}
toastr[type](message, title);
}
success(message, title, timeout) {
this.flash({
message,
title,
timeout
});
}
error(message, title, timeout) {
this.flash({
message,
type:'error',
timeout,
title
});
}
info(message, title, timeout) {
this.flash({
message,
type:'info',
timeout,
title
});
}
warning(message, title, timeout) {
this.flash({
message,
type:'warning',
timeout,
title
});
}
}
export default Notify;