Skip to content

Commit

Permalink
add a disconnected indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
e7d committed Aug 18, 2020
1 parent 7941637 commit 56d6f98
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
11 changes: 9 additions & 2 deletions js/gamepad.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,15 @@ class Gamepad {
*/
onGamepadDisconnect(e) {
// on gamepad disconnection, remove it from the list
this.disconnect(e.gamepad.index);
this.scan();
this.$gamepad.addClass('disconnected');

window.setTimeout(() => {
this.$gamepad.removeClass('disconnected');

// remove gamepad from the list and start back scanning
this.disconnect(e.gamepad.index);
this.scan();
}, 5000);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions templates/ds4/disconnected.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 56d6f98

Please sign in to comment.