Notification Fade Out
This commit is contained in:
parent
9afa4cc913
commit
9776b4f4d3
|
@ -248,7 +248,6 @@ let childModule = BDModules.get(e => e.childContainer)[0]
|
|||
function renderToElements(id, result, filename){
|
||||
const div = document.getElementById(id)
|
||||
if(!div || div.childNodes.length > 0)return // already certified/div does not exist anymore.
|
||||
// TODO: implements suspect plugins.
|
||||
|
||||
if(!flowerStarModule)flowerStarModule = BDModules.get(e => e.flowerStarContainer)[0]
|
||||
if(!childModule)childModule = BDModules.get(e => e.childContainer)[0]
|
||||
|
|
|
@ -123,6 +123,10 @@ function handleNotificationsClear() {
|
|||
function handleNotificationShow(e, notification) {
|
||||
notifications.push(notification);
|
||||
updateNotifications();
|
||||
setTimeout(() => {
|
||||
if(!notifications.find(e => e.id === notification.id))return
|
||||
handleNotificationClose(null, notification.id)
|
||||
}, 3000)
|
||||
}
|
||||
|
||||
function handleNotificationClick(e, notificationId) {
|
||||
|
@ -130,12 +134,16 @@ function handleNotificationClick(e, notificationId) {
|
|||
events.emit(NOTIFICATION_CLICK);
|
||||
}
|
||||
|
||||
let isClosing = []
|
||||
function handleNotificationClose(e, notificationId) {
|
||||
if(isClosing.includes(notificationId))return
|
||||
if (notificationWindow) {
|
||||
webContentsSend(notificationWindow, 'FADE_OUT', notificationId);
|
||||
}
|
||||
isClosing.push(notificationId)
|
||||
setTimeout(() => {
|
||||
notifications = notifications.filter(notification => notification.id !== notificationId);
|
||||
isClosing = isClosing.filter(e => e.id !== notificationId)
|
||||
updateNotifications();
|
||||
}, VARIABLES.outDuration);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue