@@ -74,19 +74,19 @@ function getOriginFromUrl(url: string): string {
74
74
return protocol + '//' + host ;
75
75
}
76
76
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
+ // });
90
90
91
91
// As this is a test app, let's only return cached data when offline.
92
92
self . addEventListener ( 'fetch' , ( event : FetchEvent ) => {
@@ -155,19 +155,19 @@ self.addEventListener('fetch', (event: FetchEvent) => {
155
155
) ;
156
156
} ) ;
157
157
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