File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,11 @@ let currentModeMessage: Notification = null;
11
11
*/
12
12
const NUMBER_TO_DISPLAY = 3 ;
13
13
14
+ /**
15
+ * Number of notifications to display at a time.
16
+ */
17
+ const TIMEOUT = 5000 ;
18
+
14
19
const notificationIcon : Record < NotificationType , string > = {
15
20
default : '' ,
16
21
warning : '⚠️ ' ,
@@ -60,7 +65,7 @@ export class Notification {
60
65
}
61
66
62
67
/**
63
- * Clear the notifications if no more exist or display another from the queue.
68
+ * Clear the notification
64
69
* @param currentId - The ID of the notification to be cleared.
65
70
*/
66
71
function clearNotification ( currentId : string ) : void {
@@ -107,15 +112,14 @@ function displayNotification (notification: Notification): void {
107
112
function startNotification ( notification : Notification ) : void {
108
113
displayNotification ( notification ) ;
109
114
notification . setTimeoutId (
110
- window . setTimeout ( clearNotification , 5000 , notification . getId ( ) )
115
+ window . setTimeout ( clearNotification , TIMEOUT , notification . getId ( ) )
111
116
) ;
112
117
document
113
118
. getElementById ( notification . getId ( ) )
114
119
. addEventListener ( 'click' , ( ) => {
115
120
window . clearTimeout ( notification . timeoutID ) ;
116
121
clearNotification ( notification . getId ( ) ) ;
117
122
} ) ;
118
-
119
123
}
120
124
121
125
/**
You can’t perform that action at this time.
0 commit comments