Turn off most logging

This commit is contained in:
Frank A. Krueger 2017-06-18 01:17:47 -07:00
parent 01668873dd
commit b660028074
2 changed files with 10 additions and 9 deletions

View File

@ -1,10 +1,12 @@
const debug = false;
// Create WebSocket connection.
const socket = new WebSocket ("ws://" + document.location.host + rootElementPath, "ooui");
console.log("Web socket created");
const nodes = {}
const nodes = {};
function getNode (id) {
switch (id) {
@ -24,7 +26,7 @@ function msgCreate (m) {
if (tagName !== "#text")
node.id = id;
nodes[id] = node;
console.log ("Created node", node);
if (debug) console.log ("Created node", node);
}
function msgSet (m) {
@ -35,7 +37,7 @@ function msgSet (m) {
return;
}
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) {
@ -46,7 +48,7 @@ function msgCall (m) {
return;
}
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);
}
@ -56,7 +58,7 @@ function msgListen (m) {
console.error ("Unknown node id", m);
return;
}
console.log ("Listen", node, m.k);
if (debug) console.log ("Listen", node, m.k);
node.addEventListener(m.k, function () {
const em = {
m: "event",
@ -68,7 +70,7 @@ function msgListen (m) {
}
const ems = JSON.stringify (em);
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) {
const messages = JSON.parse (event.data);
console.log("Messages", messages);
if (debug) console.log("Messages", messages);
if (Array.isArray (messages)) {
messages.forEach (function (m) {
// console.log('Raw value from server', m.v);

View File

@ -297,8 +297,7 @@ namespace Ooui
//
sendThrottle = new System.Timers.Timer (throttleInterval.TotalMilliseconds);
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) {
sendThrottle.Enabled = false;
lastTransmitTime = e.SignalTime;