File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change 1- const VERSION = '1.1.3 ' ;
1+ const VERSION = '1.1.4 ' ;
22const CACHE_NAME = `flag-trainer-v${ VERSION } ` ;
33const BASE_PATH = '/' ;
44
@@ -106,8 +106,27 @@ self.addEventListener('activate', (event) => {
106106 } )
107107 ) ;
108108 } ) ,
109- // Claim clients but don't force reload
110- self . clients . claim ( )
109+ // Force claim all clients
110+ self . clients . claim ( ) . then ( ( ) => {
111+ // Notify all clients about the update
112+ self . clients . matchAll ( ) . then ( clients => {
113+ clients . forEach ( client => {
114+ client . postMessage ( {
115+ type : 'APP_UPDATED' ,
116+ version : VERSION
117+ } ) ;
118+ } ) ;
119+ } ) ;
120+ } )
111121 ] )
112122 ) ;
123+ } ) ;
124+
125+ self . addEventListener ( 'message' , ( event ) => {
126+ if ( event . data && event . data . type === 'CHECK_VERSION' ) {
127+ event . ports [ 0 ] . postMessage ( {
128+ type : 'VERSION_INFO' ,
129+ version : VERSION
130+ } ) ;
131+ }
113132} ) ;
You can’t perform that action at this time.
0 commit comments