Total Complexity | 9 |
Complexity/F | 2.25 |
Lines of Code | 36 |
Function Count | 4 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | /*! |
||
12 | (function () { |
||
13 | var ElkDesktop = (function (opt) { |
||
14 | 'use strict'; |
||
15 | opt = (opt) ? opt : {}; |
||
16 | |||
17 | var send = function (request) { |
||
18 | if (request.desktop_notifications.new_from_last > 0) { |
||
19 | if (hasPermissions(request)) |
||
20 | { |
||
21 | Push.create(request.desktop_notifications.title, { |
||
|
|||
22 | body: request.desktop_notifications.message, |
||
23 | icon: opt.icon, |
||
24 | link: request.desktop_notifications.link |
||
25 | }); |
||
26 | } |
||
27 | } |
||
28 | }; |
||
29 | |||
30 | var hasPermissions = function () { |
||
31 | if (Push.Permission.has()) |
||
32 | return true; |
||
33 | |||
34 | if (Push.Permission.get() === "default") { |
||
35 | return Push.Permission.request(); |
||
36 | } |
||
37 | |||
38 | return false; |
||
39 | }; |
||
40 | |||
41 | return { |
||
42 | send: send |
||
43 | }; |
||
44 | }); |
||
45 | |||
46 | this.ElkDesktop = ElkDesktop; |
||
47 | })(); |
||
48 |
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.