-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsw.js
106 lines (98 loc) · 3.2 KB
/
sw.js
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/**
* Welcome to your Workbox-powered service worker!
*
* You'll need to register this file in your web app and you should
* disable HTTP caching for this file too.
* See https://goo.gl/nhQhGp
*
* The rest of the code is auto-generated. Please don't update this file
* directly; instead, make changes to your Workbox build configuration
* and re-run your build process.
* See https://goo.gl/2aRDsh
*/
importScripts("workbox-v3.6.1/workbox-sw.js");
workbox.setConfig({modulePathPrefix: "workbox-v3.6.1"});
workbox.core.setCacheNameDetails({prefix: "gatsby-plugin-offline"});
workbox.skipWaiting();
workbox.clientsClaim();
/**
* The workboxSW.precacheAndRoute() method efficiently caches and responds to
* requests for URLs in the manifest.
* See https://goo.gl/S9QRab
*/
self.__precacheManifest = [
{
"url": "webpack-runtime-5e5fe36ad4096f8c26d9.js"
},
{
"url": "app-84dfad870d2a7a0a3068.js"
},
{
"url": "component---node-modules-gatsby-plugin-offline-app-shell-js-a5814bd9535675e5b054.js"
},
{
"url": "index.html",
"revision": "43f91f1125e8cb2505d1a70b9baa414a"
},
{
"url": "offline-plugin-app-shell-fallback/index.html",
"revision": "b28d969e4f4cb2fb8e0a6f3ba8c69dd0"
},
{
"url": "component---src-pages-index-js-40e1e1a61483b7efd55e.js"
},
{
"url": "1-5f595227dbd0c4f850b3.js"
},
{
"url": "7-7df65c4f733bff5c67b3.js"
},
{
"url": "0-3f230486ac81ce3f79b0.js"
},
{
"url": "static/d/691/path---index-6a9-AERwzeDvu1FMvDje46jcSagRHI.json",
"revision": "337a94794356cfbedaaf6537ac92ed19"
},
{
"url": "component---src-pages-404-js-347631bac0e4855ee6e4.js"
},
{
"url": "static/d/164/path---404-html-516-62a-NZuapzHg3X9TaN1iIixfv1W23E.json",
"revision": "c2508676a2f33ea9f1f0bf472997f9a0"
},
{
"url": "static/d/520/path---offline-plugin-app-shell-fallback-a-30-c5a-NZuapzHg3X9TaN1iIixfv1W23E.json",
"revision": "c2508676a2f33ea9f1f0bf472997f9a0"
},
{
"url": "manifest.webmanifest",
"revision": "e4d44c7795f03ca9d1ce2fa97702b0d1"
}
].concat(self.__precacheManifest || []);
workbox.precaching.suppressWarnings();
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
workbox.routing.registerNavigationRoute("/offline-plugin-app-shell-fallback/index.html", {
whitelist: [/^[^?]*([^.?]{5}|\.html)(\?.*)?$/],
blacklist: [/\?(.+&)?no-cache=1$/],
});
workbox.routing.registerRoute(/\.(?:png|jpg|jpeg|webp|svg|gif|tiff|js|woff|woff2|json|css)$/, workbox.strategies.staleWhileRevalidate(), 'GET');
workbox.routing.registerRoute(/^https:/, workbox.strategies.networkFirst(), 'GET');
"use strict";
/* global workbox */
self.addEventListener("message", function (event) {
var api = event.data.api;
if (api === "gatsby-runtime-cache") {
var resources = event.data.resources;
var cacheName = workbox.core.cacheNames.runtime;
event.waitUntil(caches.open(cacheName).then(function (cache) {
return Promise.all(resources.map(function (resource) {
return cache.add(resource).catch(function (e) {
// ignore TypeErrors - these are usually due to
// external resources which don't allow CORS
if (!(e instanceof TypeError)) throw e;
});
}));
}));
}
});