Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ const App = Application.extend({
loadInitializers(App, config.modulePrefix);

export default App;

if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/service-worker.js');
Comment on lines +18 to +19
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider adding basic error handling around service worker registration.

If registration fails (e.g., invalid script, wrong path, non-HTTPS), the error is currently ignored. Consider handling the returned promise (via .then/.catch or async/await) and logging/reporting failures:

window.addEventListener('load', () => {
  navigator.serviceWorker
    .register('/service-worker.js')
    .catch((err) => {
      // log or report err
    });
});

});
}