Total Complexity | 4 |
Complexity/F | 2 |
Lines of Code | 17 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | /** |
||
8 | self.addEventListener('push', function (event) { |
||
|
|||
9 | if (!(self.Notification && self.Notification.permission === 'granted')) { |
||
10 | return; |
||
11 | } |
||
12 | |||
13 | const sendNotification = body => { |
||
14 | // you could refresh a notification badge here with postMessage API |
||
15 | const title = 'Bluz notification'; |
||
16 | |||
17 | return self.registration.showNotification(title, JSON.parse(body)); |
||
18 | }; |
||
19 | |||
20 | if (event.data) { |
||
21 | const message = event.data.text(); |
||
22 | event.waitUntil(sendNotification(message)); |
||
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.