Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
better BT disconnect detection
  • Loading branch information
lemnet committed Nov 18, 2020
1 parent 1b14bab commit 8b547c0
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,21 @@ main.onclick = (evt) => {
//vibrate on BT disconnect
function checkBT() {
if (btIcon.style.display == "none" && messaging.peerSocket.readyState === messaging.peerSocket.CLOSED) {
vibration.start('nudge-max');
btIcon.style.display = "inline";
display.poke();
setTimeout(function(){
if (messaging.peerSocket.readyState === messaging.peerSocket.CLOSED) {
setTimeout(function(){
if (messaging.peerSocket.readyState === messaging.peerSocket.CLOSED) {
vibration.start('nudge-max');
btIcon.style.display = "inline";
display.poke();
}
else if (btIcon.style.display == "inline" && messaging.peerSocket.readyState === messaging.peerSocket.OPEN)
btIcon.style.display = "none";
}, 1500);
}
else if (btIcon.style.display == "inline" && messaging.peerSocket.readyState === messaging.peerSocket.OPEN)
btIcon.style.display = "none";
}, 1500);
}
else if (btIcon.style.display == "inline" && messaging.peerSocket.readyState === messaging.peerSocket.OPEN)
btIcon.style.display = "none";
Expand Down

0 comments on commit 8b547c0

Please sign in to comment.