2018-02-11 15:29:35 +00:00
|
|
|
const setupServiceWorker = () => {
|
|
|
|
if ('serviceWorker' in navigator) {
|
|
|
|
window.addEventListener('load', () => {
|
|
|
|
navigator.serviceWorker.register('/sw.js')
|
|
|
|
.then(registration => {
|
|
|
|
console.log('SW registered:', registration); // eslint-disable-line no-console
|
|
|
|
})
|
|
|
|
.catch(registrationError => {
|
|
|
|
console.log('SW registration failed:', registrationError); // eslint-disable-line no-console
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-02-15 22:33:14 +00:00
|
|
|
export default setupServiceWorker;
|