Skip to content

Commit

Permalink
'No Connection' label is now clickable to reinitialize
Browse files Browse the repository at this point in the history
  • Loading branch information
orithena committed Oct 28, 2018
1 parent 5fb64d4 commit 6219d43
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 9 deletions.
25 changes: 19 additions & 6 deletions examples/gui/data/js/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ function colorClass(colorId) {

var websock;

function restart() {
$(document).add('*').off();
$("#row").html("");
websock.close();
start();
}

function conStatusError() {
$("#conStatus").removeClass("color-green");
$("#conStatus").addClass("color-red");
$("#conStatus").text("Error / No Connection");
$("#conStatus").off();
$("#conStatus").on({
'click': restart
});
}

function start() {
websock = new WebSocket('ws://' + window.location.hostname + '/ws');
websock.onopen = function(evt) {
Expand All @@ -93,15 +110,11 @@ function start() {
};
websock.onclose = function(evt) {
console.log('websock close');
$("#conStatus").removeClass("color-green");
$("#conStatus").addClass("color-red");
$("#conStatus").text("Error / No Connection");
conStatusError();
};
websock.onerror = function(evt) {
console.log(evt);
$("#conStatus").removeClass("color-green");
$("#conStatus").addClass("color-red");
$("#conStatus").text("Error / No Connection");
conStatusError();
};
websock.onmessage = function(evt) {
console.log(evt);
Expand Down
41 changes: 40 additions & 1 deletion examples/gui/data/js/controls.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6219d43

Please sign in to comment.