Commit 58cf61319a94306feeb49170807ef47f8a90df01
1 parent
992c8bf9
comment register service worker for disable online cache
Showing
1 changed file
with
29 additions
and
29 deletions
front-end/h5/src/registerServiceWorker.js
| 1 | /* eslint-disable no-console */ | 1 | /* eslint-disable no-console */ |
| 2 | 2 | ||
| 3 | -import { register } from 'register-service-worker' | 3 | +// import { register } from 'register-service-worker' |
| 4 | 4 | ||
| 5 | -if (process.env.NODE_ENV === 'production') { | ||
| 6 | - register(`${process.env.BASE_URL}service-worker.js`, { | ||
| 7 | - ready () { | ||
| 8 | - console.log( | ||
| 9 | - 'App is being served from cache by a service worker.\n' + | ||
| 10 | - 'For more details, visit https://goo.gl/AFskqB' | ||
| 11 | - ) | ||
| 12 | - }, | ||
| 13 | - registered () { | ||
| 14 | - console.log('Service worker has been registered.') | ||
| 15 | - }, | ||
| 16 | - cached () { | ||
| 17 | - console.log('Content has been cached for offline use.') | ||
| 18 | - }, | ||
| 19 | - updatefound () { | ||
| 20 | - console.log('New content is downloading.') | ||
| 21 | - }, | ||
| 22 | - updated () { | ||
| 23 | - console.log('New content is available; please refresh.') | ||
| 24 | - }, | ||
| 25 | - offline () { | ||
| 26 | - console.log('No internet connection found. App is running in offline mode.') | ||
| 27 | - }, | ||
| 28 | - error (error) { | ||
| 29 | - console.error('Error during service worker registration:', error) | ||
| 30 | - } | ||
| 31 | - }) | ||
| 32 | -} | 5 | +// if (process.env.NODE_ENV === 'production') { |
| 6 | +// register(`${process.env.BASE_URL}service-worker.js`, { | ||
| 7 | +// ready () { | ||
| 8 | +// console.log( | ||
| 9 | +// 'App is being served from cache by a service worker.\n' + | ||
| 10 | +// 'For more details, visit https://goo.gl/AFskqB' | ||
| 11 | +// ) | ||
| 12 | +// }, | ||
| 13 | +// registered () { | ||
| 14 | +// console.log('Service worker has been registered.') | ||
| 15 | +// }, | ||
| 16 | +// cached () { | ||
| 17 | +// console.log('Content has been cached for offline use.') | ||
| 18 | +// }, | ||
| 19 | +// updatefound () { | ||
| 20 | +// console.log('New content is downloading.') | ||
| 21 | +// }, | ||
| 22 | +// updated () { | ||
| 23 | +// console.log('New content is available; please refresh.') | ||
| 24 | +// }, | ||
| 25 | +// offline () { | ||
| 26 | +// console.log('No internet connection found. App is running in offline mode.') | ||
| 27 | +// }, | ||
| 28 | +// error (error) { | ||
| 29 | +// console.error('Error during service worker registration:', error) | ||
| 30 | +// } | ||
| 31 | +// }) | ||
| 32 | +// } |