@@ -14,7 +14,7 @@ export default class NotificationManager {
1414		if  ( instance )  { 
1515			return  instance ; 
1616		} 
17- 		this . notifications  =  this . loadNotifications ( ) ; 
17+ 		this . notifications  =  [ ] ; 
1818		instance  =  this ; 
1919	} 
2020
@@ -62,23 +62,6 @@ export default class NotificationManager {
6262		} ) ; 
6363	} 
6464
65- 	loadNotifications ( )  { 
66- 		try  { 
67- 			const  notifications  = 
68- 				JSON . parse ( localStorage . getItem ( "notifications" ) )  ||  [ ] ; 
69- 			return  notifications . map ( ( n )  =>  ( { 
70- 				...n , 
71- 				time : new  Date ( n . time ) , 
72- 			} ) ) ; 
73- 		}  catch  { 
74- 			return  [ ] ; 
75- 		} 
76- 	} 
77- 
78- 	saveNotifications ( )  { 
79- 		localStorage . setItem ( "notifications" ,  JSON . stringify ( this . notifications ) ) ; 
80- 	} 
81- 
8265	renderNotifications ( )  { 
8366		const  container  =  sidebarApps 
8467			. get ( "notification" ) 
@@ -112,7 +95,6 @@ export default class NotificationManager {
11295			if  ( index  >  - 1 )  { 
11396				notificationElement . remove ( ) ; 
11497				this . notifications . splice ( index ,  1 ) ; 
115- 				this . saveNotifications ( ) ; 
11698				this . renderNotifications ( ) ; 
11799			} 
118100		} 
@@ -141,9 +123,12 @@ export default class NotificationManager {
141123			</div> 
142124						` ; 
143125		if  ( notification . action )  { 
144- 			element . addEventListener ( "click" ,  ( )  => 
145- 				notification . action ( notification ) , 
146- 			) ; 
126+ 			element . addEventListener ( "click" ,  ( e )  =>  { 
127+ 				if  ( e . target . closest ( ".action-button" ) )  { 
128+ 					return ; 
129+ 				} 
130+ 				notification . action ( notification ) ; 
131+ 			} ) ; 
147132		} 
148133		return  element ; 
149134	} 
@@ -187,8 +172,6 @@ export default class NotificationManager {
187172			this . notifications . pop ( ) ; 
188173		} 
189174
190- 		this . saveNotifications ( ) ; 
191- 
192175		this . renderNotifications ( ) ; 
193176
194177		// show toast notification 
@@ -240,7 +223,6 @@ export default class NotificationManager {
240223
241224	clearAll ( )  { 
242225		this . notifications  =  [ ] ; 
243- 		this . saveNotifications ( ) ; 
244226		this . renderNotifications ( ) ; 
245227		if  ( this . timeUpdateInterval )  { 
246228			clearInterval ( this . timeUpdateInterval ) ; 
0 commit comments