From: Michael Jumper Date: Sat, 9 Jul 2011 16:12:06 +0000 (-0700) Subject: More JSDoc and cleanup. X-Git-Url: http://git.alex.org.uk More JSDoc and cleanup. --- diff --git a/src/main/resources/guacamole.js b/src/main/resources/guacamole.js index 7009e7a..3bff5d0 100644 --- a/src/main/resources/guacamole.js +++ b/src/main/resources/guacamole.js @@ -19,6 +19,16 @@ // Guacamole namespace var Guacamole = Guacamole || {}; +/** + * Guacamole protocol client. Given a display element and {@link Guacamole.Tunnel}, + * automatically handles incoming and outgoing Guacamole instructions via the + * provided tunnel, updating the display using one or more canvas elements. + * + * @constructor + * @param {Element} display The display element to add canvas elements to. + * @param {Guacamole.Tunnel} tunnel The tunnel to use to send and receive + * Guacamole instructions. + */ Guacamole.Client = function(display, tunnel) { var guac_client = this; diff --git a/src/main/resources/mouse.js b/src/main/resources/mouse.js index a8f3a8b..cb2af79 100644 --- a/src/main/resources/mouse.js +++ b/src/main/resources/mouse.js @@ -226,14 +226,66 @@ Guacamole.Mouse = function(element) { }; +/** + * Simple container for properties describing the state of a mouse. + * + * @constructor + * @param {Number} x The X position of the mouse pointer in pixels. + * @param {Number} y The Y position of the mouse pointer in pixels. + * @param {Boolean} left Whether the left mouse button is pressed. + * @param {Boolean} middle Whether the middle mouse button is pressed. + * @param {Boolean} right Whether the right mouse button is pressed. + * @param {Boolean} up Whether the up mouse button is pressed (the fourth + * button, usually part of a scroll wheel). + * @param {Boolean} down Whether the down mouse button is pressed (the fifth + * button, usually part of a scroll wheel). + */ Guacamole.Mouse.State = function(x, y, left, middle, right, up, down) { + /** + * The current X position of the mouse pointer. + * @type Number + */ this.x = x; + + /** + * The current Y position of the mouse pointer. + * @type Number + */ this.y = y; + + /** + * Whether the left mouse button is currently pressed. + * @type Boolean + */ this.left = left; + + /** + * Whether the middle mouse button is currently pressed. + * @type Boolean + */ this.middle = middle + + /** + * Whether the right mouse button is currently pressed. + * @type Boolean + */ this.right = right; + + /** + * Whether the up mouse button is currently pressed. This is the fourth + * mouse button, associated with upward scrolling of the mouse scroll + * wheel. + * @type Boolean + */ this.up = up; + + /** + * Whether the down mouse button is currently pressed. This is the fifth + * mouse button, associated with downward scrolling of the mouse scroll + * wheel. + * @type Boolean + */ this.down = down; }; diff --git a/src/main/resources/oskeyboard.js b/src/main/resources/oskeyboard.js index 0e6a9cc..34c2781 100644 --- a/src/main/resources/oskeyboard.js +++ b/src/main/resources/oskeyboard.js @@ -20,6 +20,14 @@ // Guacamole namespace var Guacamole = Guacamole || {}; +/** + * Dynamic on-screen keyboard. Given the URL to an XML keyboard layout file, + * this object will download and use the XML to construct a clickable on-screen + * keyboard with its own key events. + * + * @constructor + * @param {String} url The URL of an XML keyboard layout file. + */ Guacamole.OnScreenKeyboard = function(url) { var allKeys = new Array(); diff --git a/src/main/resources/tunnel.js b/src/main/resources/tunnel.js index e092088..d287589 100644 --- a/src/main/resources/tunnel.js +++ b/src/main/resources/tunnel.js @@ -19,6 +19,35 @@ // Guacamole namespace var Guacamole = Guacamole || {}; +/** + * Core object providing abstract communication for Guacamole. This object + * is a null implementation whose functions do nothing. Guacamole applications + * should use {@link Guacamole.HTTPTunnel} instead, or implement their own tunnel based + * on this one. + * + * @constructor + * @see Guacamole.HTTPTunnel + */ +Guacamole.Tunnel = function() { + + this.connect = function(data) {}; + + this.disconnect = function() {}; + + this.sendMessage = function(message) {}; + + this.onerror = null; + this.oninstruction = null; + +}; + +/** + * Guacamole Tunnel implemented over HTTP via XMLHttpRequest. + * + * @constructor + * @augments Guacamole.Tunnel + * @param {String} tunnelURL The URL of the HTTP tunneling service. + */ Guacamole.HTTPTunnel = function(tunnelURL) { var tunnel = this; @@ -44,10 +73,6 @@ Guacamole.HTTPTunnel = function(tunnelURL) { var sendingMessages = 0; var outputMessageBuffer = ""; - // Handlers - tunnel.onerror = null; - tunnel.oninstruction = null; - function sendMessage(message) { // Do not attempt to send messages if not connected @@ -267,4 +292,6 @@ Guacamole.HTTPTunnel = function(tunnelURL) { tunnel.disconnect = disconnect; tunnel.sendMessage = sendMessage; -} +}; + +Guacamole.HTTPTunnel.prototype = new Guacamole.Tunnel();