add better console.log messages
This commit is contained in:
parent
badb755812
commit
4a45350638
12
console.js
12
console.js
@ -3,6 +3,7 @@ function main() {
|
||||
var ids = [];
|
||||
|
||||
socket.onopen = function(e) {
|
||||
console.log("[LOG] sending client ping")
|
||||
socket.send("client ping");
|
||||
}
|
||||
|
||||
@ -11,8 +12,9 @@ function main() {
|
||||
|
||||
console.log(message.message)
|
||||
if (message.message === "clear") {
|
||||
console.log("[LOG] removing expressions from the graph");
|
||||
for(i in ids) {
|
||||
console.log("removing")
|
||||
console.log(`[LOG] removing expression ${ids[i]}`)
|
||||
Calc.removeExpression({
|
||||
id: ids[i],
|
||||
})
|
||||
@ -20,13 +22,13 @@ function main() {
|
||||
|
||||
ids = [];
|
||||
} else if (message.message === "expression") {
|
||||
console.log(`[LOG] adding expression ${message.payload} as id ${message.id}`);
|
||||
Calc.setExpression({
|
||||
type: "expression",
|
||||
latex: message.payload,
|
||||
id: message.id,
|
||||
})
|
||||
ids.push(message.id)
|
||||
console.log(ids)
|
||||
} else if (message.message === "ticker") {
|
||||
var state = Calc.getState();
|
||||
|
||||
@ -38,9 +40,7 @@ function main() {
|
||||
|
||||
Calc.setState(JSON.stringify(state))
|
||||
} else {
|
||||
console.log("unknown message type.")
|
||||
}
|
||||
|
||||
console.log(message);
|
||||
console.log(`[LOG] couldn't parse message ${e.data}`)
|
||||
}
|
||||
}
|
||||
} main();
|
Loading…
Reference in New Issue
Block a user