feat: Add service worker for offline install
This commit is contained in:
@@ -1324,6 +1324,15 @@
|
||||
e.returnValue = '';
|
||||
}
|
||||
});
|
||||
|
||||
// -- Service Worker to make this application work offline
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('sw.js')
|
||||
.then(reg => console.log('Service Worker Registered'))
|
||||
.catch(err => console.log('Registration Failed', err));
|
||||
});
|
||||
}
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user