Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

caching most of things #659

Merged
merged 1 commit into from
Jun 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { clientsClaim } from 'workbox-core';
import { ExpirationPlugin } from 'workbox-expiration';
import { precacheAndRoute, createHandlerBoundToURL } from 'workbox-precaching';
import { registerRoute } from 'workbox-routing';
import { StaleWhileRevalidate } from 'workbox-strategies';
import { StaleWhileRevalidate, CacheFirst } from 'workbox-strategies';

// declare const self: ServiceWorkerGlobalScope;

Expand Down Expand Up @@ -79,3 +79,8 @@ self.addEventListener('message', (event) => {
});

// Any other custom service worker logic can go here.

// GEOVATION
registerRoute(/.*pbf.*/, new CacheFirst({ "cacheName":"firebasestorage", plugins: [new ExpirationPlugin({"maxAgeSeconds":30*24*60*60,"purgeOnQuotaError":true})] }));
registerRoute(/.*firebasestorage.*/, new StaleWhileRevalidate({ "cacheName":"firebasestorage", plugins: [new ExpirationPlugin({"purgeOnQuotaError":true})] }), "GET");
registerRoute(/.*/, new StaleWhileRevalidate({ "cacheName":"all"}), "GET");