Completed
Push — develop ( 8e8cdd...300a73 )
by Xaver
31s
created

service-worker.js   A

Complexity

Total Complexity 7
Complexity/F 1.17

Size

Lines of Code 23
Function Count 6

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
wmc 7
c 1
b 0
f 0
nc 1
mnd 1
bc 7
fnc 6
dl 0
loc 23
rs 10
bpm 1.1666
cpm 1.1666
noi 5

1 Function

Rating   Name   Duplication   Size   Complexity  
A self.addEventListener(ꞌfetchꞌ) 0 12 2
1
self.addEventListener('install', function (event) {
0 ignored issues
show
Bug introduced by
The variable self seems to be never declared. If this is a global, consider adding a /** global: self */ comment.

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.

Loading history...
2
  var offlineRequest = new Request('offline.html');
0 ignored issues
show
Bug introduced by
The variable Request seems to be never declared. If this is a global, consider adding a /** global: Request */ comment.

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.

Loading history...
3
  event.waitUntil(
4
    fetch(offlineRequest).then(function (response) {
5
      return caches.open('offline').then(function (cache) {
0 ignored issues
show
Bug introduced by
The variable caches seems to be never declared. If this is a global, consider adding a /** global: caches */ comment.

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.

Loading history...
6
        return cache.put(offlineRequest, response);
7
      });
8
    })
9
  );
10
});
11
12
self.addEventListener('fetch', function (event) {
0 ignored issues
show
Bug introduced by
The variable self seems to be never declared. If this is a global, consider adding a /** global: self */ comment.

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.

Loading history...
13
  var request = event.request;
14
  if (request.method === 'GET') {
15
    event.respondWith(
16
      fetch(request).catch(function () {
17
        return caches.open('offline').then(function (cache) {
0 ignored issues
show
Bug introduced by
The variable caches seems to be never declared. If this is a global, consider adding a /** global: caches */ comment.

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.

Loading history...
18
          return cache.match('offline.html');
19
        });
20
      })
21
    );
22
  }
23
});
24