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.

javascript/domReady.js   A
last analyzed

Complexity

Total Complexity 10
Complexity/F 1.67

Size

Lines of Code 39
Function Count 6

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 24
c 0
b 0
f 0
dl 0
loc 39
rs 10
wmc 10
mnd 4
bc 4
fnc 6
bpm 0.6666
cpm 1.6666
noi 0

4 Functions

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