diff --git a/template/src/serviceWorker.js b/template/src/serviceWorker.js index 8859a0c6b20..46c98a44037 100644 --- a/template/src/serviceWorker.js +++ b/template/src/serviceWorker.js @@ -68,7 +68,7 @@ function registerValidSW(swUrl, config) { console.log('New content is available; please refresh.'); // Execute callback - if (config.onUpdate) { + if (config && config.onUpdate) { config.onUpdate(registration); } } else { @@ -78,7 +78,7 @@ function registerValidSW(swUrl, config) { console.log('Content is cached for offline use.'); // Execute callback - if (config.onSuccess) { + if (config && config.onSuccess) { config.onSuccess(registration); } }