Total Complexity | 3 |
Complexity/F | 1 |
Lines of Code | 56 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Coverage | 0% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
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 |