12345678910111213141516171819202122232425262728293031 |
- /* eslint-disable no-console */
- import { register } from 'register-service-worker';
- if (navigator.serviceWorker) {
- if (process.env.NODE_ENV === 'production') {
- register(`${process.env.BASE_URL}service-worker.js`, {
- ready() {
- console.log('Production - App is being served from cache by a service worker.');
- },
- registered() {
- console.log('Production - Service worker has been registered.');
- },
- cached() {
- console.log('Production - Content has been cached for offline use.');
- },
- updatefound() {
- console.log('Production - New content is downloading.');
- },
- updated() {
- console.log('Production - New content is available; please refresh.');
- },
- offline() {
- console.log('Production - No internet connection found. App is running in offline mode.');
- },
- error(error: any) {
- console.log('Production - Error during service worker registration:' + error);
- },
- });
- }
- }
|