Turn off most logging
This commit is contained in:
parent
01668873dd
commit
b660028074
|
@ -1,10 +1,12 @@
|
||||||
|
|
||||||
|
const debug = false;
|
||||||
|
|
||||||
// Create WebSocket connection.
|
// Create WebSocket connection.
|
||||||
const socket = new WebSocket ("ws://" + document.location.host + rootElementPath, "ooui");
|
const socket = new WebSocket ("ws://" + document.location.host + rootElementPath, "ooui");
|
||||||
|
|
||||||
console.log("Web socket created");
|
console.log("Web socket created");
|
||||||
|
|
||||||
const nodes = {}
|
const nodes = {};
|
||||||
|
|
||||||
function getNode (id) {
|
function getNode (id) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
|
@ -24,7 +26,7 @@ function msgCreate (m) {
|
||||||
if (tagName !== "#text")
|
if (tagName !== "#text")
|
||||||
node.id = id;
|
node.id = id;
|
||||||
nodes[id] = node;
|
nodes[id] = node;
|
||||||
console.log ("Created node", node);
|
if (debug) console.log ("Created node", node);
|
||||||
}
|
}
|
||||||
|
|
||||||
function msgSet (m) {
|
function msgSet (m) {
|
||||||
|
@ -35,7 +37,7 @@ function msgSet (m) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
node[m.k] = m.v;
|
node[m.k] = m.v;
|
||||||
console.log ("Set", node, m.k, m.v);
|
if (debug) console.log ("Set", node, m.k, m.v);
|
||||||
}
|
}
|
||||||
|
|
||||||
function msgCall (m) {
|
function msgCall (m) {
|
||||||
|
@ -46,7 +48,7 @@ function msgCall (m) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const f = node[m.k];
|
const f = node[m.k];
|
||||||
console.log ("Call", node, f, m.v);
|
if (debug) console.log ("Call", node, f, m.v);
|
||||||
f.apply (node, m.v);
|
f.apply (node, m.v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +58,7 @@ function msgListen (m) {
|
||||||
console.error ("Unknown node id", m);
|
console.error ("Unknown node id", m);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log ("Listen", node, m.k);
|
if (debug) console.log ("Listen", node, m.k);
|
||||||
node.addEventListener(m.k, function () {
|
node.addEventListener(m.k, function () {
|
||||||
const em = {
|
const em = {
|
||||||
m: "event",
|
m: "event",
|
||||||
|
@ -68,7 +70,7 @@ function msgListen (m) {
|
||||||
}
|
}
|
||||||
const ems = JSON.stringify (em);
|
const ems = JSON.stringify (em);
|
||||||
socket.send (ems);
|
socket.send (ems);
|
||||||
console.log ("Event", em);
|
if (debug) console.log ("Event", em);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +117,7 @@ socket.addEventListener('open', function (event) {
|
||||||
|
|
||||||
socket.addEventListener('message', function (event) {
|
socket.addEventListener('message', function (event) {
|
||||||
const messages = JSON.parse (event.data);
|
const messages = JSON.parse (event.data);
|
||||||
console.log("Messages", messages);
|
if (debug) console.log("Messages", messages);
|
||||||
if (Array.isArray (messages)) {
|
if (Array.isArray (messages)) {
|
||||||
messages.forEach (function (m) {
|
messages.forEach (function (m) {
|
||||||
// console.log('Raw value from server', m.v);
|
// console.log('Raw value from server', m.v);
|
||||||
|
|
|
@ -297,8 +297,7 @@ namespace Ooui
|
||||||
//
|
//
|
||||||
sendThrottle = new System.Timers.Timer (throttleInterval.TotalMilliseconds);
|
sendThrottle = new System.Timers.Timer (throttleInterval.TotalMilliseconds);
|
||||||
sendThrottle.Elapsed += (s, e) => {
|
sendThrottle.Elapsed += (s, e) => {
|
||||||
// e.SignalTime
|
// System.Console.WriteLine ("TICK SEND THROTTLE FOR {0}", element);
|
||||||
System.Console.WriteLine ("TICK SEND THROTTLE FOR {0}", element);
|
|
||||||
if ((e.SignalTime - lastTransmitTime) >= throttleInterval) {
|
if ((e.SignalTime - lastTransmitTime) >= throttleInterval) {
|
||||||
sendThrottle.Enabled = false;
|
sendThrottle.Enabled = false;
|
||||||
lastTransmitTime = e.SignalTime;
|
lastTransmitTime = e.SignalTime;
|
||||||
|
|
Loading…
Reference in New Issue