Add support for value and click options to UINotification

This commit is contained in:
Nariman Jelveh
2024-06-15 12:02:09 -07:00
parent 9ecd5170e7
commit e18766a651
+8 -2
View File
@@ -26,9 +26,9 @@ function UINotification(options){
window.active_notifs.push(window.global_element_id);
let h = '';
h += `<div id="ui-notification__${window.global_element_id}" data-id="${window.global_element_id}" class="notification antialiased animate__animated animate__fadeInRight animate__slow">`;
h += `<div id="ui-notification__${window.global_element_id}" data-el-id="${window.global_element_id}" class="notification antialiased animate__animated animate__fadeInRight animate__slow">`;
h += `<img class="notification-close" src="${html_encode(window.icons['close.svg'])}">`;
h += `<div class="notification-icon">`
h += `<div class="notification-icon">`;
h += `<img src="${html_encode(options.icon)}">`;
h += `</div>`;
h += `<div class="notification-content">`;
@@ -49,6 +49,12 @@ function UINotification(options){
}
})
$(el_notification).on('click', function(e){
if(options.click && typeof options.click === 'function'){
options.click(options.value);
}
})
// Show Notification
$(el_notification).delay(100).show(0);
return el_notification;