formha/static/z_comps/notify.js

34 lines
988 B
JavaScript

// https://simple-notify.github.io/simple-notify/
// https://github.com/simple-notify/simple-notify/tree/master
// const btn = document.querySelector('#btn')
/**
* Muestra una notificación personalizada
* @param {string} title - Título de la notificación
* @param {string} body - Cuerpo/Contenido de la notificación
* @param {'error'|'warning'|'success'|'info'} [typeAlert='info'] - Tipo de notificación
*/
function simpleNotification(title, body, typeAlert, autotimeout=8000){
new Notify ({
// 'error', 'warning', 'success', 'info'
status: typeAlert,
title: title,
text: body,
effect: 'fade',
speed: 500,
customClass: '',
customIcon: '',
showIcon: true,
showCloseButton: true,
autoclose: true,
autotimeout: autotimeout,
notificationsGap: null,
notificationsPadding: null,
type: 'outline',
position: 'x-center top',
customWrapper: '',
})
}
export { simpleNotification };