Skip to content

Commit

Permalink
Cache basemap in serviceworker
Browse files Browse the repository at this point in the history
  • Loading branch information
russss committed May 29, 2024
1 parent b9f4604 commit 5e2c962
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion web/src/sw.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createHandlerBoundToURL, precacheAndRoute, cleanupOutdatedCaches } from 'workbox-precaching'
import { clientsClaim } from 'workbox-core'
import { StaleWhileRevalidate } from 'workbox-strategies'
import { StaleWhileRevalidate, CacheFirst } from 'workbox-strategies'
import { registerRoute } from 'workbox-routing'

declare let self: ServiceWorkerGlobalScope
Expand All @@ -20,6 +20,8 @@ register('capabilities/buildmap', new StaleWhileRevalidate())

register('maps', new StaleWhileRevalidate({ cacheName: 'maps-20240527' }))

register('data', new CacheFirst({ cacheName: 'basemaps-20240529' }))

try {
// Only catch requests to the root URL (a regex doesn't do this).
registerRoute(
Expand Down

0 comments on commit 5e2c962

Please sign in to comment.