service worker

This commit is contained in:
vabene1111
2025-07-29 16:57:51 +02:00
parent 92578dd6a2
commit c2e522d9f2
10 changed files with 43 additions and 56 deletions

View File

@@ -4,12 +4,18 @@ import {registerRoute, setCatchHandler} from 'workbox-routing';
import {CacheFirst, NetworkFirst, NetworkOnly, StaleWhileRevalidate} from 'workbox-strategies';
import {ExpirationPlugin} from 'workbox-expiration';
import {BackgroundSyncPlugin, Queue} from "workbox-background-sync";
import { clientsClaim } from 'workbox-core'
cleanupOutdatedCaches()
declare let self: ServiceWorkerGlobalScope
precacheAndRoute(self.__WB_MANIFEST)
self.skipWaiting()
clientsClaim()
const OFFLINE_CACHE_NAME = 'offline-html';
let script_name = typeof window !== 'undefined' ? localStorage.getItem('SCRIPT_NAME') : '/'
var OFFLINE_PAGE_URL = script_name + 'offline/';