-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.js
60 lines (53 loc) · 1.2 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const moment = require('./moment');
class DeckboardClock {
constructor(props) {
this.setValue = props.setValue;
this.name = 'Clock';
this.platforms = ['WINDOWS', 'LINUX'];
this.inputs = [
{
label: 'Display Time',
value: 'clock-display-time',
icon: 'clock',
mode: 'custom-value',
fontIcon: 'fas',
color: '#1a1a1a',
input: [
{
label: 'Select Clock Format',
type: 'input:select',
items: [
{ value: 'clock-12h', label: '12 Hour Format' },
{ value: 'clock-24h', label: '24 Hour Format' }
]
}
]
}
];
this.configs = [];
this.isFirstInit = true;
}
get selections() {
return [{
header: this.name
}, ...this.inputs];
}
// Executes when the extensions loaded every time the app start.
initExtension() {
this.updateClock();
setInterval(() => {
if (this.isFirstInit) this.isFirstInit = false;
this.updateClock()
}, this.isFirstInit ? 60000 - (moment().get('seconds') * 1000) : 60000);
}
updateClock() {
this.setValue({
'clock-12h': moment().format('h:mm A'),
'clock-24h': moment().format('HH:mm')
})
}
execute() {
return;
};
}
module.exports = (sendData) => new DeckboardClock(sendData);