use @snort/system cache
This commit is contained in:
@ -3,18 +3,16 @@ import {} from ".";
|
||||
declare const self: ServiceWorkerGlobalScope;
|
||||
|
||||
import { clientsClaim } from "workbox-core";
|
||||
import { ExpirationPlugin } from "workbox-expiration";
|
||||
import { registerRoute } from "workbox-routing";
|
||||
import { StaleWhileRevalidate, CacheFirst } from "workbox-strategies";
|
||||
import { CacheFirst } from "workbox-strategies";
|
||||
|
||||
clientsClaim();
|
||||
|
||||
const staticTypes = ["image", "video", "audio"];
|
||||
const staticTypes = ["image", "video", "audio", "script", "style", "font"];
|
||||
registerRoute(
|
||||
({ request, url }) => url.origin === self.location.origin && staticTypes.includes(request.destination),
|
||||
new StaleWhileRevalidate({
|
||||
new CacheFirst({
|
||||
cacheName: "static-content",
|
||||
plugins: [new ExpirationPlugin({ maxEntries: 50 })],
|
||||
})
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user