fix notifications being delayed

This commit is contained in:
janis
2023-06-19 16:16:05 +02:00
parent b98fc4f37f
commit 9098e509e8

View File

@@ -28,7 +28,7 @@
queue: [], queue: [],
message: '', message: '',
messageType: 'hide', messageType: 'hide',
notificationDisplayTime: 1, notificationDisplayTime: 0,
notificationPriority: 'normal', notificationPriority: 'normal',
currentlyDisplayedNotificationID: 0, currentlyDisplayedNotificationID: 0,
currentID: { 'critical': 0, 'medium': 1000, 'low': 100000 }, currentID: { 'critical': 0, 'medium': 1000, 'low': 100000 },
@@ -58,6 +58,9 @@
this.notifications[ id ] = { 'message': message, 'showDuration': showDuration, 'messageType': messageType, 'priority': priority }; this.notifications[ id ] = { 'message': message, 'showDuration': showDuration, 'messageType': messageType, 'priority': priority };
this.queue.push( id ); this.queue.push( id );
console.log( 'scheduled notification: ' + id + ' (' + message + ')' ); console.log( 'scheduled notification: ' + id + ' (' + message + ')' );
if ( this.displayTimeCurrentNotification >= this.notificationDisplayTime ) {
this.handleNotifications();
}
return id; return id;
}, },
cancelNotification ( id ) { cancelNotification ( id ) {
@@ -75,6 +78,8 @@
This methods should NOT be called in any other component than this one! This methods should NOT be called in any other component than this one!
*/ */
this.displayTimeCurrentNotification = 0; this.displayTimeCurrentNotification = 0;
this.notificationDisplayTime = 0;
this.message = '';
this.queue.sort(); this.queue.sort();
if ( this.queue.length > 0 ) { if ( this.queue.length > 0 ) {
this.message = this.notifications[ this.queue[ 0 ] ][ 'message' ]; this.message = this.notifications[ this.queue[ 0 ] ][ 'message' ];
@@ -141,6 +146,7 @@
width: 100%; width: 100%;
opacity: 1; opacity: 1;
transition: all 0.5s; transition: all 0.5s;
cursor: default;
} }
.types { .types {