File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,17 @@ ReactDOM.render(
1919// If you want your app to work offline and load faster, you can change
2020// unregister() to register() below. Note this comes with some pitfalls.
2121// Learn more about service workers: https://cra.link/PWA
22- serviceWorkerRegistration . register ( ) ;
22+ serviceWorkerRegistration . register ( {
23+ onUpdate : updater
24+ } ) ;
25+
26+ function updater ( registration ) {
27+ alert ( 'New version available! Ready to update?' ) ;
28+ if ( registration && registration . waiting ) {
29+ registration . waiting . postMessage ( { type : 'SKIP_WAITING' } ) ;
30+ }
31+ window . location . reload ( ) ;
32+ }
2333
2434// If you want to start measuring performance in your app, pass a function
2535// to log results (for example: reportWebVitals(console.log))
You can’t perform that action at this time.
0 commit comments