resources/assets/js/core/autoloader.js   A
last analyzed

Complexity

Total Complexity 3
Complexity/F 1.5

Size

Lines of Code 34
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 23
c 0
b 0
f 0
dl 0
loc 34
rs 10
mnd 1
bc 1
fnc 2
bpm 0.5
cpm 1.5
noi 1

2 Functions

Rating   Name   Duplication   Size   Complexity  
A Autoloader.constructor 0 3 1
A Autoloader.lazyLoad 0 21 2
1
import { List } from './list'
2
import { Edit } from './edit'
3
import { Detail } from './detail'
4
import { Tree } from './tree'
5
6
class Autoloader {
7
    constructor() {
8
        this.lazyLoad()
9
    }
10
11
    lazyLoad() {
12
        let page = $('meta[name="page"]').attr('content')
13
14
        switch (page) {
15
            case 'list':
16
                new List()
17
                break;
18
19
            case 'edit':
20
                new Edit()
21
                break;
22
23
            case 'detail':
24
                new Detail()
25
                break;
26
27
            case 'tree':
28
                new Tree()
29
                break;
30
        }
31
    }
32
}
33
34
new Autoloader()
0 ignored issues
show
Unused Code Best Practice introduced by
The object created with new Autoloader() is not used but discarded. Consider invoking another function instead of a constructor if you are doing this purely for side effects.
Loading history...