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

Complexity

Total Complexity 5
Complexity/F 1.25

Size

Lines of Code 21
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 12
c 0
b 0
f 0
dl 0
loc 21
rs 10
wmc 5
mnd 1
bc 1
fnc 4
bpm 0.25
cpm 1.25
noi 2

3 Functions

Rating   Name   Duplication   Size   Complexity  
A Global.constructor 0 4 1
A Global.initNotifications 0 8 3
A Global.initLinks 0 3 1
1
import { Link } from './link'
2
3
export class Global {
4
    constructor() {
5
        this.initLinks()
6
        this.initNotifications()
7
    }
8
9
    initLinks() {
10
        new Link()
0 ignored issues
show
Unused Code Best Practice introduced by
The object created with new Link() is not used but discarded. Consider invoking another function instead of a constructor if you are doing this purely for side effects.
Loading history...
11
    }
12
13
    initNotifications() {
14
        $('.notification-container').each((index, element) => {
15
            let text = $(element).html()
16
            let classes = $(element).data('classes') ? $(element).data('classes') : ''
17
18
            M.toast({html: text, classes: classes})
0 ignored issues
show
Bug introduced by
The variable M seems to be never declared. If this is a global, consider adding a /** global: M */ 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...
19
        })
20
    }
21
}