Cloudinary PWA React Blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add Service Worker | |
if ('serviceWorker' in navigator) { | |
navigator.serviceWorker.register('./sw.js', { scope: './' }).then(function(reg) { | |
if (reg.installing) { | |
console.log('Service worker installing'); | |
} else if (reg.waiting) { | |
console.log('Service worker installed'); | |
} else if (reg.active) { | |
console.log('Service worker active'); | |
} | |
}).catch(function(error) { | |
// registration failed | |
console.log('Registration failed with ' + error); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment