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.
Completed
Push — master ( bb0e35...42731e )
by Vladimir
32s
created

src/front/js/services/counter.js   A

Size

Lines of Code 40

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
nc 1
dl 0
loc 40
rs 10
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A counter.js ➔ ??? 0 3 1
1
const ssn = require('short-string-number');
2
3
const config = require('./../configs/main');
4
5
/**
6
 * Counter - is class which calculates count of received messages
7
 * and shows current count value in counter block.
8
 */
9
class Counter {
10
  /**
11
   * Counter's constructor.
12
   */
13
  constructor() {
14
    this.count = 0;
15
  }
16
17
  /**
18
   * Increments counter value.
19
   */
20
  inc() {
21
    this.count += 1;
22
23
    this.showCount();
24
  }
25
26
  /**
27
   * Renders current counter value counter block.
28
   */
29
  showCount() {
30
    const c = ssn(this.count);
31
    document.getElementById('counter').innerHTML = typeof c === 'number' ? c.toString() : c;
32
    document.getElementById('counterPrecise').innerHTML = this.count.toString();
33
34
    if (this.count >= config.thresholdToDisplayCounter) {
35
      document.getElementById('counterBlock').style.display = 'block';
36
    }
37
  }
38
}
39
40
module.exports = new Counter();
41