Add a localhost-only log message pointing folks to the PWA docs. (#3455)

This commit is contained in:
Jeffrey Posnick
2017-11-15 13:51:35 -05:00
committed by Joe Haddad
parent 801fec286e
commit daf8df1ab3

View File

@@ -35,6 +35,15 @@ export default function register() {
if (isLocalhost) {
// This is running on localhost. Lets check if a service worker still exists or not.
checkValidServiceWorker(swUrl);
// Add some additional logging to localhost, pointing developers to the
// service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => {
console.log(
'This web app is being served cache-first by a service ' +
'worker. To learn more, visit https://goo.gl/SC7cgQ'
);
});
} else {
// Is not local host. Just register service worker
registerValidSW(swUrl);