Total Complexity | 10 |
Complexity/F | 2 |
Lines of Code | 48 |
Function Count | 5 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | /*! |
||
12 | (function () |
||
13 | { |
||
14 | let ElkDesktop = (function (opt) |
||
15 | { |
||
16 | 'use strict'; |
||
17 | opt = (opt) ? opt : {}; |
||
18 | |||
19 | let send = function (request) |
||
20 | { |
||
21 | if (request.desktop_notifications.new_from_last > 0) |
||
22 | { |
||
23 | if (hasPermissions(request)) |
||
24 | { |
||
25 | Push.create(request.desktop_notifications.title, { |
||
|
|||
26 | body: request.desktop_notifications.message, |
||
27 | icon: opt.icon, |
||
28 | link: request.desktop_notifications.link, // Used by mobile devices |
||
29 | onClick: function() { |
||
30 | window.focus(); |
||
31 | this.close(); |
||
32 | } |
||
33 | }); |
||
34 | } |
||
35 | } |
||
36 | }; |
||
37 | |||
38 | let hasPermissions = function () |
||
39 | { |
||
40 | if (Push.Permission.has()) |
||
41 | { |
||
42 | return true; |
||
43 | } |
||
44 | |||
45 | if (Push.Permission.get() === "default") |
||
46 | { |
||
47 | return Push.Permission.request(); |
||
48 | } |
||
49 | |||
50 | return false; |
||
51 | }; |
||
52 | |||
53 | return { |
||
54 | send: send |
||
55 | }; |
||
56 | }); |
||
57 | |||
58 | this.ElkDesktop = ElkDesktop; |
||
59 | })(); |
||
60 |
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.