mirror of
https://github.com/s00500/ESPUI.git
synced 2025-07-04 06:10:18 +00:00
Add Time control
Adds a new invisible control that can fetch the current time from a connected client. Documentation is in the README.
This commit is contained in:
11
data/js/controls.js
vendored
11
data/js/controls.js
vendored
@ -57,6 +57,9 @@ const UPDATE_ACCEL = 118;
|
||||
const UI_SEPARATOR = 19;
|
||||
const UPDATE_SEPARATOR = 119;
|
||||
|
||||
const UI_TIME = 20;
|
||||
const UPDATE_TIME = 120;
|
||||
|
||||
const UP = 0;
|
||||
const DOWN = 1;
|
||||
const LEFT = 2;
|
||||
@ -555,6 +558,11 @@ function start() {
|
||||
case UPDATE_ACCEL:
|
||||
break;
|
||||
|
||||
case UPDATE_TIME:
|
||||
var rv = new Date().toISOString();
|
||||
websock.send("time:" + rv + ":" + data.id);
|
||||
break;
|
||||
|
||||
default:
|
||||
console.error("Unknown type or event");
|
||||
break;
|
||||
@ -724,6 +732,9 @@ var addToHTML = function(data) {
|
||||
html = "<div id='id" + data.id + "' " + panelStyle + " class='sectionbreak columns'>" +
|
||||
"<h5>" + data.label + "</h5><hr/></div>";
|
||||
break;
|
||||
case UI_TIME:
|
||||
//Invisible element
|
||||
break;
|
||||
}
|
||||
|
||||
parent.append(html);
|
||||
|
Reference in New Issue
Block a user