2018-01-29 09:23:31 -08:00
|
|
|
/**
|
|
|
|
|
* @license
|
2020-05-19 12:08:49 -07:00
|
|
|
* Copyright Google LLC All Rights Reserved.
|
2018-01-29 09:23:31 -08:00
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// tslint:disable:no-console
|
|
|
|
|
|
2020-04-13 16:40:21 -07:00
|
|
|
self.addEventListener('install', event => {
|
|
|
|
|
self.skipWaiting();
|
|
|
|
|
});
|
2018-01-29 09:23:31 -08:00
|
|
|
|
|
|
|
|
self.addEventListener('activate', event => {
|
|
|
|
|
event.waitUntil(self.clients.claim());
|
2021-09-13 19:59:06 +03:00
|
|
|
|
|
|
|
|
event.waitUntil(self.registration.unregister().then(() => {
|
2020-04-13 16:40:21 -07:00
|
|
|
console.log('NGSW Safety Worker - unregistered old service worker');
|
2021-09-13 19:59:06 +03:00
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
event.waitUntil(caches.keys().then(cacheNames => {
|
|
|
|
|
const ngswCacheNames = cacheNames.filter(name => /^ngsw:/.test(name));
|
|
|
|
|
return Promise.all(ngswCacheNames.map(name => caches.delete(name)));
|
|
|
|
|
}));
|
2018-01-29 09:23:31 -08:00
|
|
|
});
|