mirror of
https://github.com/s00500/ESPUI.git
synced 2024-11-22 04:00:55 +00:00
Merge branch 'feature-restart-ui' of github.com:orithena/ESPUI
This commit is contained in:
commit
ec0b519fe3
25
examples/gui/data/js/controls.js
vendored
25
examples/gui/data/js/controls.js
vendored
@ -84,6 +84,23 @@ function colorClass(colorId) {
|
|||||||
|
|
||||||
var websock;
|
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() {
|
function start() {
|
||||||
websock = new WebSocket('ws://' + window.location.hostname + '/ws');
|
websock = new WebSocket('ws://' + window.location.hostname + '/ws');
|
||||||
websock.onopen = function(evt) {
|
websock.onopen = function(evt) {
|
||||||
@ -93,15 +110,11 @@ function start() {
|
|||||||
};
|
};
|
||||||
websock.onclose = function(evt) {
|
websock.onclose = function(evt) {
|
||||||
console.log('websock close');
|
console.log('websock close');
|
||||||
$("#conStatus").removeClass("color-green");
|
conStatusError();
|
||||||
$("#conStatus").addClass("color-red");
|
|
||||||
$("#conStatus").text("Error / No Connection");
|
|
||||||
};
|
};
|
||||||
websock.onerror = function(evt) {
|
websock.onerror = function(evt) {
|
||||||
console.log(evt);
|
console.log(evt);
|
||||||
$("#conStatus").removeClass("color-green");
|
conStatusError();
|
||||||
$("#conStatus").addClass("color-red");
|
|
||||||
$("#conStatus").text("Error / No Connection");
|
|
||||||
};
|
};
|
||||||
websock.onmessage = function(evt) {
|
websock.onmessage = function(evt) {
|
||||||
console.log(evt);
|
console.log(evt);
|
||||||
|
41
examples/gui/data/js/controls.min.js
vendored
41
examples/gui/data/js/controls.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user