Code cleanup.

This commit is contained in:
Michael Jumper
2011-10-11 15:31:01 -07:00
parent 49dd332ad9
commit 87387c5cb8
2 changed files with 10 additions and 11 deletions

View File

@@ -42,8 +42,6 @@ Guacamole.Client = function(display, tunnel) {
var currentState = STATE_IDLE;
tunnel.oninstruction = doInstruction;
tunnel.onerror = function(message) {
if (guac_client.onerror)
guac_client.onerror(message);
@@ -228,7 +226,7 @@ Guacamole.Client = function(display, tunnel) {
"error": function(parameters) {
if (guac_client.onerror) guac_client.onerror(parameters[0]);
disconnect();
guac_client.disconnect();
},
"name": function(parameters) {
@@ -409,16 +407,16 @@ Guacamole.Client = function(display, tunnel) {
};
function doInstruction(opcode, parameters) {
tunnel.oninstruction = function(opcode, parameters) {
var handler = instructionHandlers[opcode];
if (handler)
handler(parameters);
}
};
function disconnect() {
guac_client.disconnect = function() {
// Only attempt disconnection not disconnected.
if (currentState != STATE_DISCONNECTED
@@ -430,9 +428,8 @@ Guacamole.Client = function(display, tunnel) {
setState(STATE_DISCONNECTED);
}
}
guac_client.disconnect = disconnect;
};
guac_client.connect = function(data) {
setState(STATE_CONNECTING);
@@ -448,4 +445,5 @@ Guacamole.Client = function(display, tunnel) {
setState(STATE_WAITING);
};
}
};

View File

@@ -492,5 +492,6 @@ Guacamole.OnScreenKeyboard = function(url) {
};
return keyboard;
}
};