forked from Flowm/satvis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsw.js
More file actions
39 lines (36 loc) · 1.01 KB
/
sw.js
File metadata and controls
39 lines (36 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { clientsClaim } from "workbox-core";
import { registerRoute } from "workbox-routing";
import { CacheFirst } from "workbox-strategies";
import { ExpirationPlugin } from "workbox-expiration";
import { cleanupOutdatedCaches, precacheAndRoute } from "workbox-precaching";
// Cache Cesium runtime dependencies
registerRoute(
/cesium\/(Assets|Widgets|Workers)\/.*\.(css|js|json)$/,
new CacheFirst({
cacheName: "cesium-cache",
plugins: [
new ExpirationPlugin({
maxAgeSeconds: 7 * 24 * 60 * 60,
}),
],
}),
);
// Cache high res map tiles
registerRoute(
/data\/cesium-assets\/imagery\/.*\.(jpg|xml)$/,
new CacheFirst({
cacheName: "cesium-tile-cache",
plugins: [
new ExpirationPlugin({
maxEntries: 20000,
maxAgeSeconds: 7 * 24 * 60 * 60,
purgeOnQuotaError: true,
}),
],
}),
);
/* eslint-disable no-restricted-globals, no-underscore-dangle */
cleanupOutdatedCaches();
precacheAndRoute(self.__WB_MANIFEST);
self.skipWaiting();
clientsClaim();