mirror of
https://github.com/Brandon-Rozek/website-theme.git
synced 2025-06-20 08:35:33 +00:00
Compare commits
2 commits
df0ec44936
...
55a8368001
Author | SHA1 | Date | |
---|---|---|---|
55a8368001 | |||
be3e20feb6 |
2 changed files with 55 additions and 51 deletions
|
@ -66,4 +66,7 @@
|
|||
{{- partial "external/twitter_cards.html" . -}}
|
||||
|
||||
{{ partial "citation.html" . }}
|
||||
|
||||
{{- $script := resources.Get "js/script.js" -}}
|
||||
<script src="{{ $script.Permalink }}" async></script>
|
||||
</head>
|
||||
|
|
|
@ -70,12 +70,14 @@ self.addEventListener('fetch', function (event) {
|
|||
fetch(request).then(function (response) {
|
||||
// If successful, create a copy of the response
|
||||
// and save it to the cache
|
||||
// Note: Ignore badges
|
||||
if (request.url.includes("/badges")) {
|
||||
let cacheCopy = response.clone();
|
||||
event.waitUntil(caches.open(version + cacheName).then(function (cache) {
|
||||
return cache.put(request, cacheCopy);
|
||||
}));
|
||||
}
|
||||
return response;
|
||||
|
||||
}).catch(function (error) {
|
||||
// Otherwise, check the cache.
|
||||
return caches.match(request).then(function (response) {
|
||||
|
@ -84,7 +86,6 @@ self.addEventListener('fetch', function (event) {
|
|||
return response || caches.match(offlinePage);
|
||||
}
|
||||
return response;
|
||||
|
||||
});
|
||||
})
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue