Skip to content

Commit

Permalink
Register service worker on load
Browse files Browse the repository at this point in the history
  • Loading branch information
sansmoraxz committed Dec 22, 2022
1 parent ae66d48 commit 8670701
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/initialBackground.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@ if (localStorage.getItem('nightTabStyle')) {
}
document.querySelector('head').appendChild(style);
}

// check if service worker is available
if ('serviceWorker' in navigator) {
// register service worker
navigator.serviceWorker.register('./service_worker.js').then(() => {
console.log('serviceWorker registered');
}).catch(error => {
console.log('serviceWorker registration failed', error);
});
}

0 comments on commit 8670701

Please sign in to comment.