File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11( function ( ) {
2- let lastNotificationCount = 0 ;
2+ let lastNotificationCount = 0 ,
3+ responsePollInterval = 30 ;
34
45 async function update ( ) {
56 let options ,
2122 cache : 'reload'
2223 } ) ;
2324
25+ responsePollInterval = response . headers . get ( 'X-Poll-Interval' ) || responsePollInterval ;
26+
27+ setTimeout ( update , 1000 * responsePollInterval ) ;
28+
2429 if ( ! response . ok ) {
2530 throw new Error ( response . statusText ) ;
2631 }
3237 } ) ;
3338 browser . browserAction . disable ( ) ;
3439
40+ setTimeout ( update , 1000 * responsePollInterval ) ;
41+
3542 return ;
3643 }
3744
8895 } ) ;
8996 }
9097
91- setInterval ( update , 1000 * 60 ) ;
92-
9398 browser . browserAction . onClicked . addListener ( ( e ) => {
9499 const notificationsUrl = 'https://github.com/notifications' ;
95100
114119 } ) ;
115120 } ) ;
116121 } ) ;
122+
123+ update ( ) ;
117124} ) ( ) ;
You can’t perform that action at this time.
0 commit comments