feat: add PWA support

This commit is contained in:
jianjian.ma
2023-03-27 18:02:35 +08:00
parent 689b7bab26
commit 5593c067c4
3 changed files with 11 additions and 13 deletions

View File

@@ -0,0 +1,9 @@
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
navigator.serviceWorker.register('/serviceWorker.js').then(function (registration) {
console.log('ServiceWorker registration successful with scope: ', registration.scope);
}, function (err) {
console.error('ServiceWorker registration failed: ', err);
});
});
}