Remove dead SW code

Signed-off-by: Egor Savkin <es@m-labs.hk>
This commit is contained in:
Egor Savkin 2025-01-06 13:24:51 +08:00
parent 3ccbd41ef2
commit c9190565a0
3 changed files with 0 additions and 73 deletions

View File

@ -1,32 +0,0 @@
(function () {
var swRegistration;
var newWorker;
var isRefreshing = false;
var pathname = window.location.pathname;
var deferredPrompt;
if ('serviceWorker' in navigator) {
console.info('Service Worker is supported');
window.addEventListener('load', function () {
navigator.serviceWorker.register('/sw.js', {
updateViaCache: 'all',
}).then(function (registration) {
swRegistration = registration;
console.log('[SW] registration successful with scope: ', swRegistration.scope);
console.log('[SW] is waiting: ', swRegistration.waiting);
navigator.serviceWorker.addEventListener('controllerchange', function () {
if (isRefreshing) {
return;
}
window.location.reload();
isRefreshing = true;
});
}, function (err) {
console.log('[SW] registration failed: ', err);
});
});
}
})();

View File

@ -1,38 +0,0 @@
var CACHE_NAME = 'ml-03';
var urlsToCache = [
'/css/bootstrap-5.3.0.min.css',
'/css/styles.css',
'/js/bootstrap-5.3.0.min.js',
'/js/react.production.min.js',
'/js/react-dom.production.min.js',
'/js/prop-types.min.js',
'/js/react-beautiful-dnd.min.js',
'/js/uuid_v4@latest.js',
];
self.addEventListener('install', function(event) {
console.log('[SW] Install');
event.waitUntil(
caches.open(CACHE_NAME)
.then(function(cache) {
console.log('[SW] add to cache');
return cache.addAll(urlsToCache);
})
);
});
self.addEventListener('fetch', function (event) {
console.log('[SW] Fetch');
event.respondWith(
caches.match(event.request).then(function (response) {
return response || fetch(event.request);
})
);
});
self.addEventListener('message', function (event) {
if (event.data.action === 'skipWaiting') {
self.skipWaiting();
caches.delete(CACHE_NAME);
}
});

View File

@ -168,9 +168,6 @@
</div>
</div>
<!-- <script src="{{ get_url(path='js/as.js', cachebust=true) }}"></script> -->
<script src="{{ get_url(path='js/bootstrap-5.3.0.bundle.min.js', cachebust=true) }}" defer></script>
<script>