service-worker.diff
https:_user-combo.dev-eshowk.ddns.entrouvert.org_service-worker.js 2018-06-11 14:28:27.379897336 +0200 | ||
---|---|---|
1 | ||
1 | 2 |
/* global self, caches, fetch, URL, Response */ |
2 | 3 |
'use strict'; |
3 | 4 | |
4 | 5 |
var config = { |
5 |
version: 'v0',
|
|
6 |
version: 'v20180611.141555',
|
|
6 | 7 |
staticCacheItems: [ |
7 | 8 |
'/offline/' |
8 | 9 |
], |
9 | 10 |
cachePathPattern: /^\/static\/.*/, |
10 | 11 |
handleFetchPathPattern: /.*/, |
11 |
offlineImage: '<svg role="img" aria-labelledby="offline-title"' |
|
12 |
+ ' viewBox="0 0 400 300" xmlns="http://www.w3.org/2000/svg">' |
|
13 |
+ '<title id="offline-title">Offline</title>' |
|
14 |
+ '<g fill="none" fill-rule="evenodd"><path fill="#D8D8D8" d="M0 0h400v300H0z"/>' |
|
15 |
+ '<text fill="#9B9B9B" font-family="Times New Roman,Times,serif" font-size="72" font-weight="bold">' |
|
16 |
+ '<tspan x="93" y="172">offline</tspan></text></g></svg>', |
|
17 | 12 |
offlinePage: '/offline/' |
18 | 13 |
}; |
19 | 14 | |
... | ... | |
41 | 36 |
} |
42 | 37 | |
43 | 38 |
function offlineResponse (resourceType, opts) { |
44 |
if (resourceType === 'image') { |
|
45 |
return new Response(opts.offlineImage, |
|
46 |
{ headers: { 'Content-Type': 'image/svg+xml' } } |
|
47 |
); |
|
48 |
} else if (resourceType === 'content') { |
|
39 |
if (resourceType === 'content') { |
|
49 | 40 |
return caches.match(opts.offlinePage); |
50 | 41 |
} |
51 | 42 |
return undefined; |
... | ... | |
132 | 123 |
if (shouldHandleFetch(event, config)) { |
133 | 124 |
onFetch(event, config); |
134 | 125 |
} |
135 | ||
136 | 126 |
}); |