Commit 0fe5bf6c authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

tracked down weird events issue

parent 26d94159
......@@ -17,12 +17,13 @@ define(['jquery', 'underscore', 'backbone', 'serialComm', 'text!SerialMonitorVie
initialize: function(){
_.bindAll(this, "_onKeyUp");
_.bindAll(this, "_onKeyUp", "render");
$(document).bind('keyup', {}, this._onKeyUp);
this.listenTo(serialComm, "change:lastMessageReceived", this._updateIncomingMessage);
this.listenTo(serialComm, "change:lastMessageSent", this._updateOutgoingMessage);
this.listenTo(serialComm, "change:baudRate change:portName", this.render);
this.listenTo(serialComm, "change:baudRate", function(){console.log("got it")});
this.listenTo(serialComm, "change:connected", function(){
if (!serialComm.get("connected")) this._close();
});
......@@ -114,6 +115,7 @@ define(['jquery', 'underscore', 'backbone', 'serialComm', 'text!SerialMonitorVie
},
render: function(){
console.log("render");
if ($("input[type=text]").is(":focus")) return;
this.$el.html(this.template(this._makeTemplateJSON()));
},
......
......@@ -72,7 +72,6 @@ define(['underscore', 'backbone', 'socketio', 'machineState'], function(_, Backb
setProperty: function(property, value){//portName, baudRate
if (property === null || property === undefined || value === null || value === undefined) return;
this.socket.emit(property, value);//always pass user interaction on
this.set(property, value);
},
openSerialMonitor: function(){
......@@ -93,10 +92,10 @@ define(['underscore', 'backbone', 'socketio', 'machineState'], function(_, Backb
socket.on('connected', function(data){
serialComm.set("connected", true, {silent:true});
console.log(data);
_.each(_.keys(data), function(key){
if (data[key] !== null) serialComm.set(key, data[key], {silent:true});
if (data[key] !== null) serialComm.set(key, data[key]);
});
serialComm.trigger("change");
});
socket.on('dataIn', function(data){
......@@ -111,7 +110,6 @@ define(['underscore', 'backbone', 'socketio', 'machineState'], function(_, Backb
});
socket.on('isStreaming', function(data){
console.log(data);
serialComm.set("isStreaming", data);
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment