Skip to content

Commit cf5664d

Browse files
author
Alice Fernandes
committed
add travis; poke device
1 parent dd65171 commit cf5664d

File tree

3 files changed

+3318
-29
lines changed

3 files changed

+3318
-29
lines changed

.travis.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
language: node_js
2+
3+
node_js:
4+
- '12'
5+
before_install:
6+
- sudo apt-get install -y libsecret-1-0
7+
install:
8+
- npm install
9+
os:
10+
- linux
11+
env:
12+
- TARGET_ARCH=x64
13+
14+
script:
15+
- npm run build
16+
17+
branches:
18+
only:
19+
- master
20+
- /^v\d+\.\d+\.\d+.*$/
21+
22+
deploy:
23+
provider: releases
24+
api_key: $TOKEN
25+
file: 'build/app.fba'
26+
skip_cleanup: true
27+
on:
28+
tags: true

app/index.js

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
1-
import document from "document";
2-
import { display } from "display";
1+
import document from 'document';
2+
import { display } from 'display';
33

4-
(function(){
5-
let isOn = true;
6-
let defaultDisplayValue = display.brightnessOverride
7-
let defaultAutoOff = display.autoOff
8-
let root = document.getElementById("background")
9-
let background = document.getElementById("root")
10-
11-
function changeDisplay(){
12-
if(isOn){
13-
background.class = "on"
14-
background.animate("enable"); // Specify the name of the event to trigger
15-
display.brightnessOverride = "max"
16-
}else{
17-
background.class = "off"
18-
background.animate("disable"); // Specify the name of the event to trigger
19-
display.brightnessOverride = defaultDisplayValue;
20-
}
21-
}
22-
23-
root.onmouseup = function(){
24-
isOn = !isOn;
25-
changeDisplay();
26-
}
27-
28-
changeDisplay();
4+
(function () {
5+
let isOn = true;
6+
let defaultDisplayValue = display.brightnessOverride;
7+
let defaultAutoOff = display.autoOff;
8+
let root = document.getElementById('background');
9+
let background = document.getElementById('root');
10+
let interval = null;
11+
function changeDisplay() {
12+
if (isOn) {
13+
background.class = 'on';
14+
background.animate('enable'); // Specify the name of the event to trigger
15+
display.brightnessOverride = 'max';
16+
interval = setInterval(() => {
17+
display.poke();
18+
}, 50);
19+
} else {
20+
background.class = 'off';
21+
background.animate('disable'); // Specify the name of the event to trigger
22+
display.brightnessOverride = defaultDisplayValue;
23+
clearInterval(interval);
24+
}
25+
}
2926

30-
31-
})()
27+
root.onmouseup = function () {
28+
isOn = !isOn;
29+
changeDisplay();
30+
};
31+
32+
changeDisplay();
33+
})();

0 commit comments

Comments
 (0)