import { precacheAndRoute } from 'workbox-precaching' ; import { CacheableResponsePlugin } from 'workbox-cacheable-response' ; import { registerRoute } from 'workbox-routing' ; import { StaleWhileRevalidate , CacheFirst } from 'workbox-strategies' ; self . addEventListener ( 'message' , ( event ) => { if ( event . data && event . data . type === 'SKIP_WAITING' ) { self . skipWaiting ( ) ; } } ) ; registerRoute ( ( { url } ) => url . origin === 'https://pwabuilder-tests.azurewebsites.net' || url . origin === 'https://pwabuilder-serviceworker-finder.centralus.cloudapp.azure.com' , new StaleWhileRevalidate ( { } ) ) ; registerRoute ( ( { url } ) => url . origin === 'https://appimagegenerator-prod.azurewebsites.net/api/image/base64' , new CacheFirst ( { plugins : [ new CacheableResponsePlugin ( { statuses : [ 200 ] , } ) , ] , } ) , 'POST' ) ; registerRoute ( ( { url } ) => url . href === 'https://pwa-screenshots.azurewebsites.net' , new CacheFirst ( { plugins : [ new CacheableResponsePlugin ( { statuses : [ 200 ] , } ) , ] , } ) ) ; try { precacheAndRoute ( self . __WB_MANIFEST ) ; } catch ( err ) { console . info ( 'if you are in development mode this error is expected: ' , err ) ; }