Adding service worker cache
This commit is contained in:
@@ -1 +1,2 @@
|
||||
import '../../style.css';
|
||||
import '../../service-worker';
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
if ('serviceWorker' in navigator && process.env.NODE_ENV === 'production') {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('/sw.js')
|
||||
.then(registration => {
|
||||
console.log('SW registered:', registration);
|
||||
})
|
||||
.catch(registrationError => {
|
||||
console.log('SW registration failed:', registrationError);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user