[Notifications] Add toggle
This commit is contained in:
parent
7ff986e7a6
commit
d387d02534
@ -22,6 +22,9 @@ App.start({
|
||||
} else if ( request == 'clear-newest' ) {
|
||||
not.clearNewestNotifications( 0 );
|
||||
res( 'Cleared newest notification' );
|
||||
} else if ( request == 'toggle' ) {
|
||||
not.toggleNotificationMenu( 0 );
|
||||
res( 'Toggled notifications' );
|
||||
} else {
|
||||
res( 'Unknown command!' );
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user