Skip to content

Commit

Permalink
feat: add service worker cache to google font css
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaseOxide authored and ttu-ttu committed Apr 30, 2022
1 parent 45045aa commit 5c4ce28
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/web/src/service-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,13 @@ worker.addEventListener('fetch', (event) => {
: selfHostParameterizedUrlResponse(event.request);
if (response) {
event.respondWith(response);
return;
}
}

if (url.host === 'fonts.googleapis.com') {
event.respondWith(networkFirstRaceCache(event.request));
}
});

async function networkFirstRaceCache(request: Request, fallbackCacheName?: string) {
Expand Down

0 comments on commit 5c4ce28

Please sign in to comment.