Yarn upgrade
@snort/system upgrade Setup ts-load for react-intl
This commit is contained in:
@ -1,39 +1,14 @@
|
||||
/// <reference lib="webworker" />
|
||||
import {} from ".";
|
||||
declare const self: ServiceWorkerGlobalScope;
|
||||
declare const self: ServiceWorkerGlobalScope & {
|
||||
__WB_MANIFEST: (string | PrecacheEntry)[];
|
||||
};
|
||||
|
||||
import { clientsClaim } from "workbox-core";
|
||||
import { registerRoute } from "workbox-routing";
|
||||
import { CacheFirst } from "workbox-strategies";
|
||||
import { PrecacheEntry, precacheAndRoute } from "workbox-precaching";
|
||||
|
||||
precacheAndRoute(self.__WB_MANIFEST);
|
||||
clientsClaim();
|
||||
|
||||
const staticTypes = ["image", "video", "audio", "script", "style", "font"];
|
||||
registerRoute(
|
||||
({ request, url }) =>
|
||||
url.origin === self.location.origin &&
|
||||
staticTypes.includes(request.destination),
|
||||
new CacheFirst({
|
||||
cacheName: "static-content",
|
||||
})
|
||||
);
|
||||
|
||||
// External media domains which have unique urls (never changing content) and can be cached forever
|
||||
const externalMediaHosts = [
|
||||
"void.cat",
|
||||
"nostr.build",
|
||||
"imgur.com",
|
||||
"i.imgur.com",
|
||||
"pbs.twimg.com",
|
||||
"i.ibb.co",
|
||||
];
|
||||
registerRoute(
|
||||
({ url }) => externalMediaHosts.includes(url.host),
|
||||
new CacheFirst({
|
||||
cacheName: "ext-content-hosts",
|
||||
})
|
||||
);
|
||||
|
||||
self.addEventListener("message", (event) => {
|
||||
if (event.data && event.data.type === "SKIP_WAITING") {
|
||||
self.skipWaiting();
|
||||
|
Reference in New Issue
Block a user