Completed
Pull Request — master (#9)
by Flo
02:37
created

docs/assets/js/routing/http.js   A

Complexity

Total Complexity 6
Complexity/F 2

Size

Lines of Code 42
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
dl 0
loc 42
cc 0
nc 2
mnd 2
bc 5
fnc 3
rs 10
bpm 1.6666
cpm 2
noi 4

1 Function

Rating   Name   Duplication   Size   Complexity  
A ns.http.get 0 20 1
1
(function() {
2
3
    'use strict';
4
5
    var ns = faulancer.namespace('docs.routing');
0 ignored issues
show
Bug introduced by
The variable faulancer seems to be never declared. If this is a global, consider adding a /** global: faulancer */ 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
7
    var _fields = {
0 ignored issues
show
Unused Code introduced by
The variable _fields seems to be never used. Consider removing it.
Loading history...
8
        links: []
9
    };
10
11
    var _private = {
0 ignored issues
show
Unused Code introduced by
The variable _private seems to be never used. Consider removing it.
Loading history...
12
13
14
15
    };
16
17
    ns.http = {
18
19
        get: function(resource, callbackSuccess, callbackError) {
20
21
            var xhr = new XMLHttpRequest();
0 ignored issues
show
Bug introduced by
The variable XMLHttpRequest seems to be never declared. If this is a global, consider adding a /** global: XMLHttpRequest */ 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...
22
            xhr.open('GET', resource);
23
24
            xhr.onreadystatechange = function() {
25
26
                if (xhr.readyState === 4 && xhr.status === 200) {
27
                    callbackSuccess(xhr.responseText);
28
                } else if (xhr.status === 400) {
29
                    callbackError(xhr.responseText);
30
                }
31
32
            };
33
34
            xhr.overrideMimeType('text/html');
35
36
            xhr.send();
37
38
        }
39
40
    };
41
42
})();
43