GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( a07b43...22864d )
by Sebastian
02:11
created

javascript/domReady.js   A

Complexity

Total Complexity 9
Complexity/F 1.8

Size

Lines of Code 35
Function Count 5

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
cc 0
eloc 21
nc 1
dl 0
loc 35
rs 10
c 4
b 0
f 0
wmc 9
mnd 2
bc 9
fnc 5
bpm 1.8
cpm 1.8
noi 0

4 Functions

Rating   Name   Duplication   Size   Complexity  
A domReady.js ➔ domHandleCallback 0 7 2
A domReady.js ➔ domLoaded 0 3 2
A domReady.js ➔ domReady 0 7 1
A domReady.js ➔ domAddEventListener 0 13 2
1
'use strict';
2
3
function domReady(fn) {
4
    var fns = [],
5
        loaded = domLoaded();
6
7
    domAddEventListener(fns, loaded);
8
    domHandleCallback(loaded, fns, fn);
9
}
10
11
function domLoaded() {
12
    return (document.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(document.readyState);
13
}
14
15
function domAddEventListener(fns, loaded) {
16
    var listener;
17
18
    if (!loaded) {
19
        document.addEventListener('DOMContentLoaded', listener = function () {
20
            document.removeEventListener('DOMContentLoaded', listener);
21
            loaded = true;
22
            while (listener = fns.shift()) {
23
                listener();
24
            }
25
        })
26
    }
27
}
28
29
function domHandleCallback(loaded, fns, fn) {
30
    if (loaded) {
31
        setTimeout(fn, 0);
32
    } else {
33
        fns.push(fn);
34
    }
35
}
36