Total Complexity | 7 |
Complexity/F | 1.17 |
Lines of Code | 24 |
Function Count | 6 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | self.addEventListener('install', function (event) { |
||
|
|||
2 | var offlineRequest = new Request('offline.html'); |
||
3 | event.waitUntil( |
||
4 | fetch(offlineRequest).then(function (response) { |
||
5 | return caches.open('offline').then(function (cache) { |
||
6 | return cache.put(offlineRequest, response); |
||
7 | }); |
||
8 | }) |
||
9 | ); |
||
10 | }); |
||
11 | |||
12 | self.addEventListener('fetch', function (event) { |
||
13 | var request = event.request; |
||
14 | if (request.method === 'GET') { |
||
15 | event.respondWith( |
||
16 | fetch(request).catch(function () { |
||
17 | console.log(request); |
||
18 | return caches.open('offline').then(function (cache) { |
||
19 | return cache.match('offline.html'); |
||
20 | }); |
||
21 | }) |
||
22 | ); |
||
23 | } |
||
24 | }); |
||
25 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.