|
|
@ -75,10 +75,9 @@ const registerValidSW = (swUrl: string, config?: Config) => {
|
|
|
|
// but the previous service worker will still serve the older
|
|
|
|
// but the previous service worker will still serve the older
|
|
|
|
// content until all client tabs are closed.
|
|
|
|
// content until all client tabs are closed.
|
|
|
|
|
|
|
|
|
|
|
|
// console.log(
|
|
|
|
console.info(
|
|
|
|
// "New content is available and will be used when all " +
|
|
|
|
"New content is available and will be used when all tabs for this page are closed.",
|
|
|
|
// "tabs for this page are closed.",
|
|
|
|
);
|
|
|
|
// );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Execute callback
|
|
|
|
// Execute callback
|
|
|
|
if (config && config.onUpdate) {
|
|
|
|
if (config && config.onUpdate) {
|
|
|
@ -89,7 +88,7 @@ const registerValidSW = (swUrl: string, config?: Config) => {
|
|
|
|
// It's the perfect time to display a
|
|
|
|
// It's the perfect time to display a
|
|
|
|
// "Content is cached for offline use." message.
|
|
|
|
// "Content is cached for offline use." message.
|
|
|
|
|
|
|
|
|
|
|
|
// console.log("Content is cached for offline use.");
|
|
|
|
console.info("Content is cached for offline use.");
|
|
|
|
|
|
|
|
|
|
|
|
// Execute callback
|
|
|
|
// Execute callback
|
|
|
|
if (config && config.onSuccess) {
|
|
|
|
if (config && config.onSuccess) {
|
|
|
@ -128,10 +127,11 @@ const checkValidServiceWorker = (swUrl: string, config?: Config) => {
|
|
|
|
registerValidSW(swUrl, config);
|
|
|
|
registerValidSW(swUrl, config);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
.catch((error) => {
|
|
|
|
// console.log(
|
|
|
|
console.info(
|
|
|
|
// "No internet connection found. App is running in offline mode.",
|
|
|
|
"No internet connection found. App is running in offline mode.",
|
|
|
|
// );
|
|
|
|
error.message,
|
|
|
|
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|