files/js/touchbar.js   A
last analyzed

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 56
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 0
wmc 3
c 2
b 0
f 0
nc 1
mnd 0
bc 3
fnc 3
dl 0
loc 56
ccs 0
cts 13
cp 0
crap 0
rs 10
bpm 1
cpm 1
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A touchbar.js ➔ ??? 0 4 1
1
"use strict";
2
3
/* eslint-disable no-unused-vars */
4
5
const {
6
    app,
7
    BrowserWindow,
8
    TouchBar
9
} = require('electron');
10
11
const {
12
    TouchBarLabel,
13
    TouchBarButton,
14
    TouchBarSpacer
15
} = TouchBar;
16
17
let mainWindow;
18
19
20
let setMainWindow = (main) => {
21
    mainWindow = main;
22
    return mainWindow;
23
};
24
25
let button = (labelText, bgColor, fName, fText) => {
26
    let meh = new TouchBarButton({
27
        label: labelText,
28
        backgroundColor: bgColor,
29
        click: () => {
30
            mainWindow.webContents.send(fName, fText);
31
        }
32
    });
33
34
    return meh;
35
};
36
37
38
const disconnect = button("Disconnect", "#7463A9", "disconnect", "whoooooosh!");
39
40
const connect = button('⏹ Connect', 'rgb(214, 78, 35)', "connect", "whoooooosh!");
41
42
const touchBar = new TouchBar([
43
    disconnect,
44
    new TouchBarSpacer({
45
        size: 'large'
46
    }),
47
    connect,
48
    new TouchBarSpacer({
49
        size: 'large'
50
    })
51
]);
52
53
module.exports = {
54
    setMainWindow: setMainWindow,
55
    touchBar: touchBar
56
};
57