@@ -74,19 +74,19 @@ function getOriginFromUrl(url: string): string {
7474 return protocol + '//' + host ;
7575}
7676
77- self . addEventListener ( 'install' , ( event : ExtendableEvent ) => {
78- // Perform install steps.
79- event . waitUntil ( async ( ) : Promise < void > => {
80- const cache = await caches . open ( CACHE_NAME ) ;
81- // Add all URLs of resources we want to cache.
82- try {
83- await cache . addAll ( urlsToCache ) ;
84- } catch {
85- // Suppress error as some of the files may not be available for the
86- // current page.
87- }
88- } ) ;
89- } ) ;
77+ // self.addEventListener('install', (event: ExtendableEvent) => {
78+ // // Perform install steps.
79+ // event.waitUntil(async (): Promise<void> => {
80+ // const cache = await caches.open(CACHE_NAME);
81+ // // Add all URLs of resources we want to cache.
82+ // try {
83+ // await cache.addAll(urlsToCache);
84+ // } catch {
85+ // // Suppress error as some of the files may not be available for the
86+ // // current page.
87+ // }
88+ // });
89+ // });
9090
9191// As this is a test app, let's only return cached data when offline.
9292self . addEventListener ( 'fetch' , ( event : FetchEvent ) => {
@@ -155,19 +155,19 @@ self.addEventListener('fetch', (event: FetchEvent) => {
155155 ) ;
156156} ) ;
157157
158- self . addEventListener ( 'activate' , ( event : ExtendableEvent ) => {
159- // Update this list with all caches that need to remain cached.
160- const cacheWhitelist = [ 'cache-v1' ] ;
161- event . waitUntil ( async ( ) : Promise < void > => {
162- const cacheNames = await caches . keys ( ) ;
163- await Promise . all (
164- cacheNames . map ( cacheName => {
165- // Check if cache is not whitelisted above.
166- if ( cacheWhitelist . indexOf ( cacheName ) === - 1 ) {
167- // If not whitelisted, delete it.
168- return caches . delete ( cacheName ) ;
169- }
170- } )
171- ) ;
172- } ) ;
173- } ) ;
158+ // self.addEventListener('activate', (event: ExtendableEvent) => {
159+ // // Update this list with all caches that need to remain cached.
160+ // const cacheWhitelist = ['cache-v1'];
161+ // event.waitUntil(async (): Promise<void> => {
162+ // const cacheNames = await caches.keys();
163+ // await Promise.all(
164+ // cacheNames.map(cacheName => {
165+ // // Check if cache is not whitelisted above.
166+ // if (cacheWhitelist.indexOf(cacheName) === -1) {
167+ // // If not whitelisted, delete it.
168+ // return caches.delete(cacheName);
169+ // }
170+ // })
171+ // );
172+ // });
173+ // });
0 commit comments