Skip to content

Commit

Permalink
feat: register service worker, #8126
Browse files Browse the repository at this point in the history
  • Loading branch information
psychobunny committed Sep 28, 2020
1 parent 54705cc commit aa268d5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions public/src/app.js
Expand Up @@ -52,6 +52,7 @@ app.cacheBuster = null;
createHeaderTooltips();
app.showEmailConfirmWarning();
app.showCookieWarning();
registerServiceWorker();

require(['taskbar', 'helpers', 'forum/pagination'], function (taskbar, helpers, pagination) {
taskbar.init();
Expand Down Expand Up @@ -688,4 +689,15 @@ app.cacheBuster = null;
});
});
};

function registerServiceWorker() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/service-worker.js')
.then(function () {
console.log('ServiceWorker registration succeeded.');
}).catch(function (err) {
console.log('ServiceWorker registration failed: ', err);
});
}
}
}());

0 comments on commit aa268d5

Please sign in to comment.