shellphone.app/app/service-worker/fetch.ts

11 lines
284 B
TypeScript
Raw Normal View History

2022-06-01 21:56:37 +00:00
declare let self: ServiceWorkerGlobalScope;
export default async function handleFetch(event: FetchEvent & { preloadResponse?: Promise<Response | undefined> }) {
const preloaded = await event.preloadResponse;
if (preloaded) {
return preloaded;
}
return fetch(event.request);
}