Skip to content

Commit

Permalink
Add a localhost-only log message pointing folks to the PWA docs. (#3455)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffposnick authored and Timer committed Nov 15, 2017
1 parent 801fec2 commit daf8df1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/react-scripts/template/src/registerServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit daf8df1

Please sign in to comment.