[Notifications] Add toggle
This commit is contained in:
@@ -39,7 +39,7 @@ class Notifier implements Subscribable {
|
||||
} );
|
||||
|
||||
this.notifd.connect( 'resolved', ( _, id ) => {
|
||||
this.hide( id );
|
||||
this.delete( id );
|
||||
} );
|
||||
}
|
||||
|
||||
@@ -124,6 +124,14 @@ class Notifier implements Subscribable {
|
||||
} )
|
||||
}
|
||||
|
||||
toggleNotificationMenu () {
|
||||
if ( this.menuOpen ) {
|
||||
this.hideNotifications();
|
||||
} else {
|
||||
this.openNotificationMenu();
|
||||
}
|
||||
}
|
||||
|
||||
clearAllNotifications () {
|
||||
this.menuOpen = false;
|
||||
this.notifications.forEach( ( _, id ) => {
|
||||
@@ -157,6 +165,10 @@ const closeNotificationMenu = ( id: number ) => {
|
||||
notifiers.get( id )?.hideNotifications();
|
||||
}
|
||||
|
||||
const toggleNotificationMenu = ( id: number ) => {
|
||||
notifiers.get( id )?.toggleNotificationMenu();
|
||||
}
|
||||
|
||||
const clearAllNotifications = ( id: number ) => {
|
||||
notifiers.get( id )?.clearAllNotifications();
|
||||
}
|
||||
|
Reference in New Issue
Block a user