GUACAMOLE-986: Merge update documentation of parameters/returns.

This commit is contained in:
Virtually Nick
2021-12-19 18:32:33 -05:00
committed by GitHub
32 changed files with 1636 additions and 977 deletions

View File

@@ -25,8 +25,8 @@ var Guacamole = Guacamole || {};
* overwrite any installed event handlers on the given Guacamole.InputStream. * overwrite any installed event handlers on the given Guacamole.InputStream.
* *
* @constructor * @constructor
* @param {Guacamole.InputStream} stream The stream that data will be read * @param {!Guacamole.InputStream} stream
* from. * The stream that data will be read from.
*/ */
Guacamole.ArrayBufferReader = function(stream) { Guacamole.ArrayBufferReader = function(stream) {
@@ -63,7 +63,8 @@ Guacamole.ArrayBufferReader = function(stream) {
* Fired once for every blob of data received. * Fired once for every blob of data received.
* *
* @event * @event
* @param {ArrayBuffer} buffer The data packet received. * @param {!ArrayBuffer} buffer
* The data packet received.
*/ */
this.ondata = null; this.ondata = null;

View File

@@ -24,14 +24,16 @@ var Guacamole = Guacamole || {};
* binary data, supplied as ArrayBuffers. * binary data, supplied as ArrayBuffers.
* *
* @constructor * @constructor
* @param {Guacamole.OutputStream} stream The stream that data will be written * @param {!Guacamole.OutputStream} stream
* to. * The stream that data will be written to.
*/ */
Guacamole.ArrayBufferWriter = function(stream) { Guacamole.ArrayBufferWriter = function(stream) {
/** /**
* Reference to this Guacamole.StringWriter. * Reference to this Guacamole.StringWriter.
*
* @private * @private
* @type {!Guacamole.ArrayBufferWriter}
*/ */
var guac_writer = this; var guac_writer = this;
@@ -46,7 +48,8 @@ Guacamole.ArrayBufferWriter = function(stream) {
* be small enough to fit into a single blob instruction. * be small enough to fit into a single blob instruction.
* *
* @private * @private
* @param {Uint8Array} bytes The data to send. * @param {!Uint8Array} bytes
* The data to send.
*/ */
function __send_blob(bytes) { function __send_blob(bytes) {
@@ -70,7 +73,7 @@ Guacamole.ArrayBufferWriter = function(stream) {
* 8192 bytes, and the contents of blobs will be base64-encoded, this value * 8192 bytes, and the contents of blobs will be base64-encoded, this value
* should only be increased with extreme caution. * should only be increased with extreme caution.
* *
* @type {Number} * @type {!number}
* @default {@link Guacamole.ArrayBufferWriter.DEFAULT_BLOB_LENGTH} * @default {@link Guacamole.ArrayBufferWriter.DEFAULT_BLOB_LENGTH}
*/ */
this.blobLength = Guacamole.ArrayBufferWriter.DEFAULT_BLOB_LENGTH; this.blobLength = Guacamole.ArrayBufferWriter.DEFAULT_BLOB_LENGTH;
@@ -78,7 +81,8 @@ Guacamole.ArrayBufferWriter = function(stream) {
/** /**
* Sends the given data. * Sends the given data.
* *
* @param {ArrayBuffer|TypedArray} data The data to send. * @param {!(ArrayBuffer|TypedArray)} data
* The data to send.
*/ */
this.sendData = function(data) { this.sendData = function(data) {
@@ -107,7 +111,8 @@ Guacamole.ArrayBufferWriter = function(stream) {
/** /**
* Fired for received data, if acknowledged by the server. * Fired for received data, if acknowledged by the server.
* @event * @event
* @param {Guacamole.Status} status The status of the operation. * @param {!Guacamole.Status} status
* The status of the operation.
*/ */
this.onack = null; this.onack = null;
@@ -118,6 +123,6 @@ Guacamole.ArrayBufferWriter = function(stream) {
* instances. * instances.
* *
* @constant * @constant
* @type {Number} * @type {!number}
*/ */
Guacamole.ArrayBufferWriter.DEFAULT_BLOB_LENGTH = 6048; Guacamole.ArrayBufferWriter.DEFAULT_BLOB_LENGTH = 6048;

View File

@@ -46,10 +46,10 @@ Guacamole.AudioPlayer = function AudioPlayer() {
* implementation of Guacamole.AudioPlayer, and thus will be properly handled * implementation of Guacamole.AudioPlayer, and thus will be properly handled
* by Guacamole.AudioPlayer.getInstance(). * by Guacamole.AudioPlayer.getInstance().
* *
* @param {String} mimetype * @param {!string} mimetype
* The mimetype to check. * The mimetype to check.
* *
* @returns {Boolean} * @returns {!boolean}
* true if the given mimetype is supported by any built-in * true if the given mimetype is supported by any built-in
* Guacamole.AudioPlayer, false otherwise. * Guacamole.AudioPlayer, false otherwise.
*/ */
@@ -68,7 +68,7 @@ Guacamole.AudioPlayer.isSupportedType = function isSupportedType(mimetype) {
* additional parameters. Something like "audio/L8;rate=44100" would be valid, * additional parameters. Something like "audio/L8;rate=44100" would be valid,
* however (see https://tools.ietf.org/html/rfc4856). * however (see https://tools.ietf.org/html/rfc4856).
* *
* @returns {String[]} * @returns {!string[]}
* A list of all mimetypes supported by any built-in Guacamole.AudioPlayer, * A list of all mimetypes supported by any built-in Guacamole.AudioPlayer,
* excluding any parameters. * excluding any parameters.
*/ */
@@ -83,10 +83,10 @@ Guacamole.AudioPlayer.getSupportedTypes = function getSupportedTypes() {
* audio format. If support for the given audio format is not available, null * audio format. If support for the given audio format is not available, null
* is returned. * is returned.
* *
* @param {Guacamole.InputStream} stream * @param {!Guacamole.InputStream} stream
* The Guacamole.InputStream to read audio data from. * The Guacamole.InputStream to read audio data from.
* *
* @param {String} mimetype * @param {!string} mimetype
* The mimetype of the audio data in the provided stream. * The mimetype of the audio data in the provided stream.
* *
* @return {Guacamole.AudioPlayer} * @return {Guacamole.AudioPlayer}
@@ -112,10 +112,10 @@ Guacamole.AudioPlayer.getInstance = function getInstance(stream, mimetype) {
* *
* @constructor * @constructor
* @augments Guacamole.AudioPlayer * @augments Guacamole.AudioPlayer
* @param {Guacamole.InputStream} stream * @param {!Guacamole.InputStream} stream
* The Guacamole.InputStream to read audio data from. * The Guacamole.InputStream to read audio data from.
* *
* @param {String} mimetype * @param {!string} mimetype
* The mimetype of the audio data in the provided stream, which must be a * The mimetype of the audio data in the provided stream, which must be a
* "audio/L8" or "audio/L16" mimetype with necessary parameters, such as: * "audio/L8" or "audio/L16" mimetype with necessary parameters, such as:
* "audio/L16;rate=44100,channels=2". * "audio/L16;rate=44100,channels=2".
@@ -146,7 +146,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) {
* resolution. * resolution.
* *
* @private * @private
* @type {Number} * @type {!number}
*/ */
var nextPacketTime = context.currentTime; var nextPacketTime = context.currentTime;
@@ -155,7 +155,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) {
* provided with this Guacamole.RawAudioPlayer was created. * provided with this Guacamole.RawAudioPlayer was created.
* *
* @private * @private
* @type {Guacamole.ArrayBufferReader} * @type {!Guacamole.ArrayBufferReader}
*/ */
var reader = new Guacamole.ArrayBufferReader(stream); var reader = new Guacamole.ArrayBufferReader(stream);
@@ -167,7 +167,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) {
* *
* @private * @private
* @constant * @constant
* @type {Number} * @type {!number}
*/ */
var MIN_SPLIT_SIZE = 0.02; var MIN_SPLIT_SIZE = 0.02;
@@ -177,7 +177,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) {
* roughly one third of a second. * roughly one third of a second.
* *
* @private * @private
* @type {Number} * @type {!number}
*/ */
var maxLatency = 0.3; var maxLatency = 0.3;
@@ -197,7 +197,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) {
* sample, and will be 128 for 8-bit audio and 32768 for 16-bit audio. * sample, and will be 128 for 8-bit audio and 32768 for 16-bit audio.
* *
* @private * @private
* @type {Number} * @type {!number}
*/ */
var maxSampleValue = (format.bytesPerSample === 1) ? 128 : 32768; var maxSampleValue = (format.bytesPerSample === 1) ? 128 : 32768;
@@ -209,7 +209,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) {
* no further modifications can be made to that packet. * no further modifications can be made to that packet.
* *
* @private * @private
* @type {SampleArray[]} * @type {!SampleArray[]}
*/ */
var packetQueue = []; var packetQueue = [];
@@ -218,7 +218,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) {
* containing the concatenation of those packets. * containing the concatenation of those packets.
* *
* @private * @private
* @param {SampleArray[]} packets * @param {!SampleArray[]} packets
* The array of audio packets to concatenate. * The array of audio packets to concatenate.
* *
* @returns {SampleArray} * @returns {SampleArray}
@@ -258,7 +258,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) {
* the originally-provided audio packet is returned. * the originally-provided audio packet is returned.
* *
* @private * @private
* @param {SampleArray} data * @param {!SampleArray} data
* The audio packet to split. * The audio packet to split.
* *
* @returns {!SampleArray[]} * @returns {!SampleArray[]}
@@ -326,7 +326,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) {
* conversions will be performed automatically internally. * conversions will be performed automatically internally.
* *
* @private * @private
* @param {ArrayBuffer} data * @param {!ArrayBuffer} data
* A raw packet of audio data that should be pushed onto the audio * A raw packet of audio data that should be pushed onto the audio
* playback queue. * playback queue.
*/ */
@@ -343,7 +343,8 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) {
* @private * @private
* @returns {SampleArray} * @returns {SampleArray}
* A packet of audio data pulled from the beginning of the playback * A packet of audio data pulled from the beginning of the playback
* queue. * queue. If there is no audio currently in the playback queue, this
* will be null.
*/ */
var shiftAudioPacket = function shiftAudioPacket() { var shiftAudioPacket = function shiftAudioPacket() {
@@ -367,7 +368,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) {
* into isolated planes of channel-specific data. * into isolated planes of channel-specific data.
* *
* @private * @private
* @param {SampleArray} data * @param {!SampleArray} data
* The raw audio packet that should be converted into a Web Audio API * The raw audio packet that should be converted into a Web Audio API
* AudioBuffer. * AudioBuffer.
* *
@@ -460,10 +461,10 @@ Guacamole.RawAudioPlayer.prototype = new Guacamole.AudioPlayer();
* Determines whether the given mimetype is supported by * Determines whether the given mimetype is supported by
* Guacamole.RawAudioPlayer. * Guacamole.RawAudioPlayer.
* *
* @param {String} mimetype * @param {!string} mimetype
* The mimetype to check. * The mimetype to check.
* *
* @returns {boolean} * @returns {!boolean}
* true if the given mimetype is supported by Guacamole.RawAudioPlayer, * true if the given mimetype is supported by Guacamole.RawAudioPlayer,
* false otherwise. * false otherwise.
*/ */
@@ -485,7 +486,7 @@ Guacamole.RawAudioPlayer.isSupportedType = function isSupportedType(mimetype) {
* additional parameters. Something like "audio/L8;rate=44100" would be valid, * additional parameters. Something like "audio/L8;rate=44100" would be valid,
* however (see https://tools.ietf.org/html/rfc4856). * however (see https://tools.ietf.org/html/rfc4856).
* *
* @returns {string[]} * @returns {!string[]}
* A list of all mimetypes supported by Guacamole.RawAudioPlayer, excluding * A list of all mimetypes supported by Guacamole.RawAudioPlayer, excluding
* any parameters. If the necessary JavaScript APIs for playing raw audio * any parameters. If the necessary JavaScript APIs for playing raw audio
* are absent, this list will be empty. * are absent, this list will be empty.

View File

@@ -57,10 +57,10 @@ Guacamole.AudioRecorder = function AudioRecorder() {
* implementation of Guacamole.AudioRecorder, and thus will be properly handled * implementation of Guacamole.AudioRecorder, and thus will be properly handled
* by Guacamole.AudioRecorder.getInstance(). * by Guacamole.AudioRecorder.getInstance().
* *
* @param {String} mimetype * @param {!string} mimetype
* The mimetype to check. * The mimetype to check.
* *
* @returns {Boolean} * @returns {!boolean}
* true if the given mimetype is supported by any built-in * true if the given mimetype is supported by any built-in
* Guacamole.AudioRecorder, false otherwise. * Guacamole.AudioRecorder, false otherwise.
*/ */
@@ -79,7 +79,7 @@ Guacamole.AudioRecorder.isSupportedType = function isSupportedType(mimetype) {
* additional parameters. Something like "audio/L8;rate=44100" would be valid, * additional parameters. Something like "audio/L8;rate=44100" would be valid,
* however (see https://tools.ietf.org/html/rfc4856). * however (see https://tools.ietf.org/html/rfc4856).
* *
* @returns {String[]} * @returns {!string[]}
* A list of all mimetypes supported by any built-in * A list of all mimetypes supported by any built-in
* Guacamole.AudioRecorder, excluding any parameters. * Guacamole.AudioRecorder, excluding any parameters.
*/ */
@@ -94,10 +94,10 @@ Guacamole.AudioRecorder.getSupportedTypes = function getSupportedTypes() {
* given audio format. If support for the given audio format is not available, * given audio format. If support for the given audio format is not available,
* null is returned. * null is returned.
* *
* @param {Guacamole.OutputStream} stream * @param {!Guacamole.OutputStream} stream
* The Guacamole.OutputStream to send audio data through. * The Guacamole.OutputStream to send audio data through.
* *
* @param {String} mimetype * @param {!string} mimetype
* The mimetype of the audio data to be sent along the provided stream. * The mimetype of the audio data to be sent along the provided stream.
* *
* @return {Guacamole.AudioRecorder} * @return {Guacamole.AudioRecorder}
@@ -123,10 +123,10 @@ Guacamole.AudioRecorder.getInstance = function getInstance(stream, mimetype) {
* *
* @constructor * @constructor
* @augments Guacamole.AudioRecorder * @augments Guacamole.AudioRecorder
* @param {Guacamole.OutputStream} stream * @param {!Guacamole.OutputStream} stream
* The Guacamole.OutputStream to write audio data to. * The Guacamole.OutputStream to write audio data to.
* *
* @param {String} mimetype * @param {!string} mimetype
* The mimetype of the audio data to send along the provided stream, which * The mimetype of the audio data to send along the provided stream, which
* must be a "audio/L8" or "audio/L16" mimetype with necessary parameters, * must be a "audio/L8" or "audio/L16" mimetype with necessary parameters,
* such as: "audio/L16;rate=44100,channels=2". * such as: "audio/L16;rate=44100,channels=2".
@@ -137,7 +137,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) {
* Reference to this RawAudioRecorder. * Reference to this RawAudioRecorder.
* *
* @private * @private
* @type {Guacamole.RawAudioRecorder} * @type {!Guacamole.RawAudioRecorder}
*/ */
var recorder = this; var recorder = this;
@@ -149,7 +149,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) {
* *
* @private * @private
* @constant * @constant
* @type {Number} * @type {!number}
*/ */
var BUFFER_SIZE = 2048; var BUFFER_SIZE = 2048;
@@ -160,7 +160,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) {
* *
* @private * @private
* @contant * @contant
* @type Number * @type {!number}
*/ */
var LANCZOS_WINDOW_SIZE = 3; var LANCZOS_WINDOW_SIZE = 3;
@@ -201,7 +201,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) {
* provided when this Guacamole.RawAudioRecorder was created. * provided when this Guacamole.RawAudioRecorder was created.
* *
* @private * @private
* @type {Guacamole.ArrayBufferWriter} * @type {!Guacamole.ArrayBufferWriter}
*/ */
var writer = new Guacamole.ArrayBufferWriter(stream); var writer = new Guacamole.ArrayBufferWriter(stream);
@@ -221,7 +221,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) {
* and will be 128 for 8-bit audio and 32768 for 16-bit audio. * and will be 128 for 8-bit audio and 32768 for 16-bit audio.
* *
* @private * @private
* @type {Number} * @type {!number}
*/ */
var maxSampleValue = (format.bytesPerSample === 1) ? 128 : 32768; var maxSampleValue = (format.bytesPerSample === 1) ? 128 : 32768;
@@ -230,7 +230,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) {
* over the life of this audio recorder. * over the life of this audio recorder.
* *
* @private * @private
* @type {Number} * @type {!number}
*/ */
var readSamples = 0; var readSamples = 0;
@@ -239,7 +239,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) {
* connection over the life of this audio recorder. * connection over the life of this audio recorder.
* *
* @private * @private
* @type {Number} * @type {!number}
*/ */
var writtenSamples = 0; var writtenSamples = 0;
@@ -247,7 +247,8 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) {
* The audio stream provided by the browser, if allowed. If no stream has * The audio stream provided by the browser, if allowed. If no stream has
* yet been received, this will be null. * yet been received, this will be null.
* *
* @type MediaStream * @private
* @type {MediaStream}
*/ */
var mediaStream = null; var mediaStream = null;
@@ -275,10 +276,10 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) {
* See: https://en.wikipedia.org/wiki/Sinc_function * See: https://en.wikipedia.org/wiki/Sinc_function
* *
* @private * @private
* @param {Number} x * @param {!number} x
* The point at which the normalized sinc function should be computed. * The point at which the normalized sinc function should be computed.
* *
* @returns {number} * @returns {!number}
* The value of the normalized sinc function at x. * The value of the normalized sinc function at x.
*/ */
var sinc = function sinc(x) { var sinc = function sinc(x) {
@@ -298,14 +299,14 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) {
* size. See: https://en.wikipedia.org/wiki/Lanczos_resampling * size. See: https://en.wikipedia.org/wiki/Lanczos_resampling
* *
* @private * @private
* @param {Number} x * @param {!number} x
* The point at which the value of the Lanczos kernel should be * The point at which the value of the Lanczos kernel should be
* computed. * computed.
* *
* @param {Number} a * @param {!number} a
* The window size to use for the Lanczos kernel. * The window size to use for the Lanczos kernel.
* *
* @returns {number} * @returns {!number}
* The value of the Lanczos kernel at the given point for the given * The value of the Lanczos kernel at the given point for the given
* window size. * window size.
*/ */
@@ -327,16 +328,16 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) {
* be derived through interpolating nearby samples. * be derived through interpolating nearby samples.
* *
* @private * @private
* @param {Float32Array} audioData * @param {!Float32Array} audioData
* An array of audio data, as returned by AudioBuffer.getChannelData(). * An array of audio data, as returned by AudioBuffer.getChannelData().
* *
* @param {Number} t * @param {!number} t
* The relative location within the waveform from which the value * The relative location within the waveform from which the value
* should be retrieved, represented as a floating point number between * should be retrieved, represented as a floating point number between
* 0 and 1 inclusive, where 0 represents the earliest point in time and * 0 and 1 inclusive, where 0 represents the earliest point in time and
* 1 represents the latest. * 1 represents the latest.
* *
* @returns {number} * @returns {!number}
* The value of the waveform at the given location. * The value of the waveform at the given location.
*/ */
var interpolateSample = function getValueAt(audioData, t) { var interpolateSample = function getValueAt(audioData, t) {
@@ -367,7 +368,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) {
* split into isolated planes of channel-specific data. * split into isolated planes of channel-specific data.
* *
* @private * @private
* @param {AudioBuffer} audioBuffer * @param {!AudioBuffer} audioBuffer
* The Web Audio API AudioBuffer that should be converted to a raw * The Web Audio API AudioBuffer that should be converted to a raw
* audio packet. * audio packet.
* *
@@ -416,7 +417,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) {
* audio stream (successful start of recording). * audio stream (successful start of recording).
* *
* @private * @private
* @param {MediaStream} stream * @param {!MediaStream} stream
* A MediaStream which provides access to audio data read from the * A MediaStream which provides access to audio data read from the
* user's local audio input device. * user's local audio input device.
*/ */
@@ -558,10 +559,10 @@ Guacamole.RawAudioRecorder.prototype = new Guacamole.AudioRecorder();
* Determines whether the given mimetype is supported by * Determines whether the given mimetype is supported by
* Guacamole.RawAudioRecorder. * Guacamole.RawAudioRecorder.
* *
* @param {String} mimetype * @param {!string} mimetype
* The mimetype to check. * The mimetype to check.
* *
* @returns {boolean} * @returns {!boolean}
* true if the given mimetype is supported by Guacamole.RawAudioRecorder, * true if the given mimetype is supported by Guacamole.RawAudioRecorder,
* false otherwise. * false otherwise.
*/ */
@@ -583,7 +584,7 @@ Guacamole.RawAudioRecorder.isSupportedType = function isSupportedType(mimetype)
* additional parameters. Something like "audio/L8;rate=44100" would be valid, * additional parameters. Something like "audio/L8;rate=44100" would be valid,
* however (see https://tools.ietf.org/html/rfc4856). * however (see https://tools.ietf.org/html/rfc4856).
* *
* @returns {string[]} * @returns {!string[]}
* A list of all mimetypes supported by Guacamole.RawAudioRecorder, * A list of all mimetypes supported by Guacamole.RawAudioRecorder,
* excluding any parameters. If the necessary JavaScript APIs for recording * excluding any parameters. If the necessary JavaScript APIs for recording
* raw audio are absent, this list will be empty. * raw audio are absent, this list will be empty.

View File

@@ -26,21 +26,27 @@ var Guacamole = Guacamole || {};
* given Guacamole.InputStream. * given Guacamole.InputStream.
* *
* @constructor * @constructor
* @param {Guacamole.InputStream} stream The stream that data will be read * @param {!Guacamole.InputStream} stream
* from. * The stream that data will be read from.
* @param {String} mimetype The mimetype of the blob being built. *
* @param {!string} mimetype
* The mimetype of the blob being built.
*/ */
Guacamole.BlobReader = function(stream, mimetype) { Guacamole.BlobReader = function(stream, mimetype) {
/** /**
* Reference to this Guacamole.InputStream. * Reference to this Guacamole.InputStream.
*
* @private * @private
* @type {!Guacamole.BlobReader}
*/ */
var guac_reader = this; var guac_reader = this;
/** /**
* The length of this Guacamole.InputStream in bytes. * The length of this Guacamole.InputStream in bytes.
*
* @private * @private
* @type {!number}
*/ */
var length = 0; var length = 0;
@@ -97,7 +103,9 @@ Guacamole.BlobReader = function(stream, mimetype) {
/** /**
* Returns the current length of this Guacamole.InputStream, in bytes. * Returns the current length of this Guacamole.InputStream, in bytes.
* @return {Number} The current length of this Guacamole.InputStream. *
* @return {!number}
* The current length of this Guacamole.InputStream.
*/ */
this.getLength = function() { this.getLength = function() {
return length; return length;
@@ -105,7 +113,9 @@ Guacamole.BlobReader = function(stream, mimetype) {
/** /**
* Returns the contents of this Guacamole.BlobReader as a Blob. * Returns the contents of this Guacamole.BlobReader as a Blob.
* @return {Blob} The contents of this Guacamole.BlobReader. *
* @return {!Blob}
* The contents of this Guacamole.BlobReader.
*/ */
this.getBlob = function() { this.getBlob = function() {
return blob_builder.getBlob(); return blob_builder.getBlob();
@@ -115,7 +125,8 @@ Guacamole.BlobReader = function(stream, mimetype) {
* Fired once for every blob of data received. * Fired once for every blob of data received.
* *
* @event * @event
* @param {Number} length The number of bytes received. * @param {!number} length
* The number of bytes received.
*/ */
this.onprogress = null; this.onprogress = null;

View File

@@ -24,7 +24,7 @@ var Guacamole = Guacamole || {};
* contents of provided Blob objects. * contents of provided Blob objects.
* *
* @constructor * @constructor
* @param {Guacamole.OutputStream} stream * @param {!Guacamole.OutputStream} stream
* The stream that data will be written to. * The stream that data will be written to.
*/ */
Guacamole.BlobWriter = function BlobWriter(stream) { Guacamole.BlobWriter = function BlobWriter(stream) {
@@ -33,7 +33,7 @@ Guacamole.BlobWriter = function BlobWriter(stream) {
* Reference to this Guacamole.BlobWriter. * Reference to this Guacamole.BlobWriter.
* *
* @private * @private
* @type {Guacamole.BlobWriter} * @type {!Guacamole.BlobWriter}
*/ */
var guacWriter = this; var guacWriter = this;
@@ -42,7 +42,7 @@ Guacamole.BlobWriter = function BlobWriter(stream) {
* provided file data. * provided file data.
* *
* @private * @private
* @type {Guacamole.ArrayBufferWriter} * @type {!Guacamole.ArrayBufferWriter}
*/ */
var arrayBufferWriter = new Guacamole.ArrayBufferWriter(stream); var arrayBufferWriter = new Guacamole.ArrayBufferWriter(stream);
@@ -58,13 +58,13 @@ Guacamole.BlobWriter = function BlobWriter(stream) {
* length. * length.
* *
* @private * @private
* @param {Blob} blob * @param {!Blob} blob
* The Blob to slice. * The Blob to slice.
* *
* @param {Number} start * @param {!number} start
* The starting offset of the slice, in bytes, inclusive. * The starting offset of the slice, in bytes, inclusive.
* *
* @param {Number} end * @param {!number} end
* The ending offset of the slice, in bytes, exclusive. * The ending offset of the slice, in bytes, exclusive.
* *
* @returns {!Blob} * @returns {!Blob}
@@ -102,7 +102,7 @@ Guacamole.BlobWriter = function BlobWriter(stream) {
/** /**
* Sends the contents of the given blob over the underlying stream. * Sends the contents of the given blob over the underlying stream.
* *
* @param {Blob} blob * @param {!Blob} blob
* The blob to send. * The blob to send.
*/ */
this.sendBlob = function sendBlob(blob) { this.sendBlob = function sendBlob(blob) {
@@ -196,7 +196,7 @@ Guacamole.BlobWriter = function BlobWriter(stream) {
* Fired for received data, if acknowledged by the server. * Fired for received data, if acknowledged by the server.
* *
* @event * @event
* @param {Guacamole.Status} status * @param {!Guacamole.Status} status
* The status of the operation. * The status of the operation.
*/ */
this.onack = null; this.onack = null;
@@ -207,13 +207,13 @@ Guacamole.BlobWriter = function BlobWriter(stream) {
* the given blob will cease, but the stream will remain open. * the given blob will cease, but the stream will remain open.
* *
* @event * @event
* @param {Blob} blob * @param {!Blob} blob
* The blob that was being read when the error occurred. * The blob that was being read when the error occurred.
* *
* @param {Number} offset * @param {!number} offset
* The offset of the failed read attempt within the blob, in bytes. * The offset of the failed read attempt within the blob, in bytes.
* *
* @param {DOMError} error * @param {!DOMError} error
* The error that occurred. * The error that occurred.
*/ */
this.onerror = null; this.onerror = null;
@@ -223,10 +223,10 @@ Guacamole.BlobWriter = function BlobWriter(stream) {
* via [sendBlob()]{@link Guacamole.BlobWriter#sendBlob}. * via [sendBlob()]{@link Guacamole.BlobWriter#sendBlob}.
* *
* @event * @event
* @param {Blob} blob * @param {!Blob} blob
* The blob that is being read. * The blob that is being read.
* *
* @param {Number} offset * @param {!number} offset
* The offset of the read that just succeeded. * The offset of the read that just succeeded.
*/ */
this.onprogress = null; this.onprogress = null;
@@ -237,7 +237,7 @@ Guacamole.BlobWriter = function BlobWriter(stream) {
* sent. * sent.
* *
* @event * @event
* @param {Blob} blob * @param {!Blob} blob
* The blob that was sent. * The blob that was sent.
*/ */
this.oncomplete = null; this.oncomplete = null;

View File

@@ -25,8 +25,8 @@ var Guacamole = Guacamole || {};
* provided tunnel, updating its display using one or more canvas elements. * provided tunnel, updating its display using one or more canvas elements.
* *
* @constructor * @constructor
* @param {Guacamole.Tunnel} tunnel The tunnel to use to send and receive * @param {!Guacamole.Tunnel} tunnel
* Guacamole instructions. * The tunnel to use to send and receive Guacamole instructions.
*/ */
Guacamole.Client = function(tunnel) { Guacamole.Client = function(tunnel) {
@@ -46,7 +46,9 @@ Guacamole.Client = function(tunnel) {
/** /**
* Translation from Guacamole protocol line caps to Layer line caps. * Translation from Guacamole protocol line caps to Layer line caps.
*
* @private * @private
* @type {!Object.<number, string>}
*/ */
var lineCap = { var lineCap = {
0: "butt", 0: "butt",
@@ -56,7 +58,9 @@ Guacamole.Client = function(tunnel) {
/** /**
* Translation from Guacamole protocol line caps to Layer line caps. * Translation from Guacamole protocol line caps to Layer line caps.
*
* @private * @private
* @type {!Object.<number, string>}
*/ */
var lineJoin = { var lineJoin = {
0: "bevel", 0: "bevel",
@@ -68,7 +72,7 @@ Guacamole.Client = function(tunnel) {
* The underlying Guacamole display. * The underlying Guacamole display.
* *
* @private * @private
* @type {Guacamole.Display} * @type {!Guacamole.Display}
*/ */
var display = new Guacamole.Display(); var display = new Guacamole.Display();
@@ -76,7 +80,7 @@ Guacamole.Client = function(tunnel) {
* All available layers and buffers * All available layers and buffers
* *
* @private * @private
* @type {Object.<Number, (Guacamole.Display.VisibleLayer|Guacamole.Layer)>} * @type {!Object.<number, (Guacamole.Display.VisibleLayer|Guacamole.Layer)>}
*/ */
var layers = {}; var layers = {};
@@ -85,7 +89,7 @@ Guacamole.Client = function(tunnel) {
* be empty, but audio players may be allocated by the server upon request. * be empty, but audio players may be allocated by the server upon request.
* *
* @private * @private
* @type {Object.<Number, Guacamole.AudioPlayer>} * @type {!Object.<number, Guacamole.AudioPlayer>}
*/ */
var audioPlayers = {}; var audioPlayers = {};
@@ -94,7 +98,7 @@ Guacamole.Client = function(tunnel) {
* be empty, but video players may be allocated by the server upon request. * be empty, but video players may be allocated by the server upon request.
* *
* @private * @private
* @type {Object.<Number, Guacamole.VideoPlayer>} * @type {!Object.<number, Guacamole.VideoPlayer>}
*/ */
var videoPlayers = {}; var videoPlayers = {};
@@ -109,7 +113,7 @@ Guacamole.Client = function(tunnel) {
* Guacamole server. * Guacamole server.
* *
* @private * @private
* @type {Guacamole.Object[]} * @type {!Guacamole.Object[]}
*/ */
var objects = []; var objects = [];
@@ -138,7 +142,7 @@ Guacamole.Client = function(tunnel) {
* effectively an independent, compressed snapshot of protocol and display * effectively an independent, compressed snapshot of protocol and display
* state. Invoking this function implicitly flushes the display. * state. Invoking this function implicitly flushes the display.
* *
* @param {function} callback * @param {!function} callback
* Callback which should be invoked once the state object is ready. The * Callback which should be invoked once the state object is ready. The
* state object will be passed to the callback as the sole parameter. * state object will be passed to the callback as the sole parameter.
* This callback may be invoked immediately, or later as the display * This callback may be invoked immediately, or later as the display
@@ -207,7 +211,7 @@ Guacamole.Client = function(tunnel) {
* object from a prior call to exportState(). The Guacamole.Client instance * object from a prior call to exportState(). The Guacamole.Client instance
* used to export that state need not be the same as this instance. * used to export that state need not be the same as this instance.
* *
* @param {Object} state * @param {!object} state
* An opaque representation of Guacamole.Client state from a prior call * An opaque representation of Guacamole.Client state from a prior call
* to exportState(). * to exportState().
* *
@@ -280,8 +284,8 @@ Guacamole.Client = function(tunnel) {
* contains an Element which can be added to the DOM, causing the * contains an Element which can be added to the DOM, causing the
* display to become visible. * display to become visible.
* *
* @return {Guacamole.Display} The underlying display of this * @return {!Guacamole.Display}
* Guacamole.Client. * The underlying display of this Guacamole.Client.
*/ */
this.getDisplay = function() { this.getDisplay = function() {
return display; return display;
@@ -290,8 +294,11 @@ Guacamole.Client = function(tunnel) {
/** /**
* Sends the current size of the screen. * Sends the current size of the screen.
* *
* @param {Number} width The width of the screen. * @param {!number} width
* @param {Number} height The height of the screen. * The width of the screen.
*
* @param {!number} height
* The height of the screen.
*/ */
this.sendSize = function(width, height) { this.sendSize = function(width, height) {
@@ -307,9 +314,11 @@ Guacamole.Client = function(tunnel) {
* Sends a key event having the given properties as if the user * Sends a key event having the given properties as if the user
* pressed or released a key. * pressed or released a key.
* *
* @param {Boolean} pressed Whether the key is pressed (true) or released * @param {!boolean} pressed
* (false). * Whether the key is pressed (true) or released (false).
* @param {Number} keysym The keysym of the key being pressed or released. *
* @param {!number} keysym
* The keysym of the key being pressed or released.
*/ */
this.sendKeyEvent = function(pressed, keysym) { this.sendKeyEvent = function(pressed, keysym) {
// Do not send requests if not connected // Do not send requests if not connected
@@ -323,10 +332,10 @@ Guacamole.Client = function(tunnel) {
* Sends a mouse event having the properties provided by the given mouse * Sends a mouse event having the properties provided by the given mouse
* state. * state.
* *
* @param {Guacamole.Mouse.State} mouseState * @param {!Guacamole.Mouse.State} mouseState
* The state of the mouse to send in the mouse event. * The state of the mouse to send in the mouse event.
* *
* @param {Boolean} [applyDisplayScale=false] * @param {boolean} [applyDisplayScale=false]
* Whether the provided mouse state uses local display units, rather * Whether the provided mouse state uses local display units, rather
* than remote display units, and should be scaled to match the * than remote display units, and should be scaled to match the
* {@link Guacamole.Display}. * {@link Guacamole.Display}.
@@ -368,10 +377,10 @@ Guacamole.Client = function(tunnel) {
* Sends a touch event having the properties provided by the given touch * Sends a touch event having the properties provided by the given touch
* state. * state.
* *
* @param {Guacamole.Touch.State} touchState * @param {!Guacamole.Touch.State} touchState
* The state of the touch contact to send in the touch event. * The state of the touch contact to send in the touch event.
* *
* @param {Boolean} [applyDisplayScale=false] * @param {boolean} [applyDisplayScale=false]
* Whether the provided touch state uses local display units, rather * Whether the provided touch state uses local display units, rather
* than remote display units, and should be scaled to match the * than remote display units, and should be scaled to match the
* {@link Guacamole.Display}. * {@link Guacamole.Display}.
@@ -426,7 +435,7 @@ Guacamole.Client = function(tunnel) {
* mimetype will be sent along the returned stream. The instruction * mimetype will be sent along the returned stream. The instruction
* necessary to create this stream will automatically be sent. * necessary to create this stream will automatically be sent.
* *
* @param {String} mimetype * @param {!string} mimetype
* The mimetype of the audio data that will be sent along the returned * The mimetype of the audio data that will be sent along the returned
* stream. * stream.
* *
@@ -447,9 +456,14 @@ Guacamole.Client = function(tunnel) {
* filename. The instruction necessary to create this stream will * filename. The instruction necessary to create this stream will
* automatically be sent. * automatically be sent.
* *
* @param {String} mimetype The mimetype of the file being sent. * @param {!string} mimetype
* @param {String} filename The filename of the file being sent. * The mimetype of the file being sent.
* @return {!Guacamole.OutputStream} The created file stream. *
* @param {!string} filename
* The filename of the file being sent.
*
* @return {!Guacamole.OutputStream}
* The created file stream.
*/ */
this.createFileStream = function(mimetype, filename) { this.createFileStream = function(mimetype, filename) {
@@ -464,9 +478,14 @@ Guacamole.Client = function(tunnel) {
* Opens a new pipe for writing, having the given name and mimetype. The * Opens a new pipe for writing, having the given name and mimetype. The
* instruction necessary to create this stream will automatically be sent. * instruction necessary to create this stream will automatically be sent.
* *
* @param {String} mimetype The mimetype of the data being sent. * @param {!string} mimetype
* @param {String} name The name of the pipe. * The mimetype of the data being sent.
* @return {!Guacamole.OutputStream} The created file stream. *
* @param {!string} name
* The name of the pipe.
*
* @return {!Guacamole.OutputStream}
* The created file stream.
*/ */
this.createPipeStream = function(mimetype, name) { this.createPipeStream = function(mimetype, name) {
@@ -481,9 +500,14 @@ Guacamole.Client = function(tunnel) {
* Opens a new clipboard object for writing, having the given mimetype. The * Opens a new clipboard object for writing, having the given mimetype. The
* instruction necessary to create this stream will automatically be sent. * instruction necessary to create this stream will automatically be sent.
* *
* @param {String} mimetype The mimetype of the data being sent. * @param {!string} mimetype
* @param {String} name The name of the pipe. * The mimetype of the data being sent.
* @return {!Guacamole.OutputStream} The created file stream. *
* @param {!string} name
* The name of the pipe.
*
* @return {!Guacamole.OutputStream}
* The created file stream.
*/ */
this.createClipboardStream = function(mimetype) { this.createClipboardStream = function(mimetype) {
@@ -501,13 +525,13 @@ Guacamole.Client = function(tunnel) {
* of the following stream. The instruction necessary to create this stream * of the following stream. The instruction necessary to create this stream
* will automatically be sent. * will automatically be sent.
* *
* @param {String} mimetype * @param {!string} mimetype
* The mimetype of the data being sent. * The mimetype of the data being sent.
* *
* @param {String} name * @param {!string} name
* The name of the connection parameter to attempt to update. * The name of the connection parameter to attempt to update.
* *
* @return {Guacamole.OutputStream} * @return {!Guacamole.OutputStream}
* The created argument value stream. * The created argument value stream.
*/ */
this.createArgumentValueStream = function createArgumentValueStream(mimetype, name) { this.createArgumentValueStream = function createArgumentValueStream(mimetype, name) {
@@ -525,14 +549,14 @@ Guacamole.Client = function(tunnel) {
* dictated by the object itself. The instruction necessary to create this * dictated by the object itself. The instruction necessary to create this
* stream will automatically be sent. * stream will automatically be sent.
* *
* @param {Number} index * @param {!number} index
* The index of the object for which the output stream is being * The index of the object for which the output stream is being
* created. * created.
* *
* @param {String} mimetype * @param {!string} mimetype
* The mimetype of the data which will be sent to the output stream. * The mimetype of the data which will be sent to the output stream.
* *
* @param {String} name * @param {!string} name
* The defined name of an output stream within the given object. * The defined name of an output stream within the given object.
* *
* @returns {!Guacamole.OutputStream} * @returns {!Guacamole.OutputStream}
@@ -552,11 +576,11 @@ Guacamole.Client = function(tunnel) {
* Requests read access to the input stream having the given name. If * Requests read access to the input stream having the given name. If
* successful, a new input stream will be created. * successful, a new input stream will be created.
* *
* @param {Number} index * @param {!number} index
* The index of the object from which the input stream is being * The index of the object from which the input stream is being
* requested. * requested.
* *
* @param {String} name * @param {!string} name
* The name of the input stream to request. * The name of the input stream to request.
*/ */
this.requestObjectInputStream = function requestObjectInputStream(index, name) { this.requestObjectInputStream = function requestObjectInputStream(index, name) {
@@ -571,11 +595,14 @@ Guacamole.Client = function(tunnel) {
/** /**
* Acknowledge receipt of a blob on the stream with the given index. * Acknowledge receipt of a blob on the stream with the given index.
* *
* @param {Number} index The index of the stream associated with the * @param {!number} index
* received blob. * The index of the stream associated with the received blob.
* @param {String} message A human-readable message describing the error *
* or status. * @param {!string} message
* @param {Number} code The error code, if any, or 0 for success. * A human-readable message describing the error or status.
*
* @param {!number} code
* The error code, if any, or 0 for success.
*/ */
this.sendAck = function(index, message, code) { this.sendAck = function(index, message, code) {
@@ -589,8 +616,11 @@ Guacamole.Client = function(tunnel) {
/** /**
* Given the index of a file, writes a blob of data to that file. * Given the index of a file, writes a blob of data to that file.
* *
* @param {Number} index The index of the file to write to. * @param {!number} index
* @param {String} data Base64-encoded data to write to the file. * The index of the file to write to.
*
* @param {!string} data
* Base64-encoded data to write to the file.
*/ */
this.sendBlob = function(index, data) { this.sendBlob = function(index, data) {
@@ -607,7 +637,7 @@ Guacamole.Client = function(tunnel) {
* stream is closed, and the index will be made available for reuse in * stream is closed, and the index will be made available for reuse in
* future streams. * future streams.
* *
* @param {Number} index * @param {!number} index
* The index of the stream to end. * The index of the stream to end.
*/ */
this.endStream = function(index) { this.endStream = function(index) {
@@ -631,7 +661,8 @@ Guacamole.Client = function(tunnel) {
* Fired whenever the state of this Guacamole.Client changes. * Fired whenever the state of this Guacamole.Client changes.
* *
* @event * @event
* @param {Number} state The new state of the client. * @param {!number} state
* The new state of the client.
*/ */
this.onstatechange = null; this.onstatechange = null;
@@ -639,7 +670,8 @@ Guacamole.Client = function(tunnel) {
* Fired when the remote client sends a name update. * Fired when the remote client sends a name update.
* *
* @event * @event
* @param {String} name The new name of this client. * @param {!string} name
* The new name of this client.
*/ */
this.onname = null; this.onname = null;
@@ -648,8 +680,8 @@ Guacamole.Client = function(tunnel) {
* is being closed. * is being closed.
* *
* @event * @event
* @param {Guacamole.Status} status A status object which describes the * @param {!Guacamole.Status} status
* error. * A status object which describes the error.
*/ */
this.onerror = null; this.onerror = null;
@@ -658,10 +690,10 @@ Guacamole.Client = function(tunnel) {
* handler will contain its own event handlers for received data. * handler will contain its own event handlers for received data.
* *
* @event * @event
* @param {Guacamole.InputStream} stream * @param {!Guacamole.InputStream} stream
* The stream that will receive audio data from the server. * The stream that will receive audio data from the server.
* *
* @param {String} mimetype * @param {!string} mimetype
* The mimetype of the audio data which will be received. * The mimetype of the audio data which will be received.
* *
* @return {Guacamole.AudioPlayer} * @return {Guacamole.AudioPlayer}
@@ -677,15 +709,15 @@ Guacamole.Client = function(tunnel) {
* handler will contain its own event handlers for received data. * handler will contain its own event handlers for received data.
* *
* @event * @event
* @param {Guacamole.InputStream} stream * @param {!Guacamole.InputStream} stream
* The stream that will receive video data from the server. * The stream that will receive video data from the server.
* *
* @param {Guacamole.Display.VisibleLayer} layer * @param {!Guacamole.Display.VisibleLayer} layer
* The destination layer on which the received video data should be * The destination layer on which the received video data should be
* played. It is the responsibility of the Guacamole.VideoPlayer * played. It is the responsibility of the Guacamole.VideoPlayer
* implementation to play the received data within this layer. * implementation to play the received data within this layer.
* *
* @param {String} mimetype * @param {!string} mimetype
* The mimetype of the video data which will be received. * The mimetype of the video data which will be received.
* *
* @return {Guacamole.VideoPlayer} * @return {Guacamole.VideoPlayer}
@@ -701,10 +733,10 @@ Guacamole.Client = function(tunnel) {
* multi-touch support provided by a particular display layer. * multi-touch support provided by a particular display layer.
* *
* @event * @event
* @param {Guacamole.Display.VisibleLayer} layer * @param {!Guacamole.Display.VisibleLayer} layer
* The layer whose multi-touch support level is being declared. * The layer whose multi-touch support level is being declared.
* *
* @param {Number} touches * @param {!number} touches
* The maximum number of simultaneous touches supported by the given * The maximum number of simultaneous touches supported by the given
* layer, where 0 indicates that touch events are not supported at all. * layer, where 0 indicates that touch events are not supported at all.
*/ */
@@ -715,14 +747,14 @@ Guacamole.Client = function(tunnel) {
* by the server. * by the server.
* *
* @event * @event
* @param {Guacamole.InputStream} stream * @param {!Guacamole.InputStream} stream
* The stream that will receive connection parameter data from the * The stream that will receive connection parameter data from the
* server. * server.
* *
* @param {String} mimetype * @param {!string} mimetype
* The mimetype of the data which will be received. * The mimetype of the data which will be received.
* *
* @param {String} name * @param {!string} name
* The name of the connection parameter whose value is being exposed. * The name of the connection parameter whose value is being exposed.
*/ */
this.onargv = null; this.onargv = null;
@@ -731,9 +763,11 @@ Guacamole.Client = function(tunnel) {
* Fired when the clipboard of the remote client is changing. * Fired when the clipboard of the remote client is changing.
* *
* @event * @event
* @param {Guacamole.InputStream} stream The stream that will receive * @param {!Guacamole.InputStream} stream
* clipboard data from the server. * The stream that will receive clipboard data from the server.
* @param {String} mimetype The mimetype of the data which will be received. *
* @param {!string} mimetype
* The mimetype of the data which will be received.
*/ */
this.onclipboard = null; this.onclipboard = null;
@@ -742,10 +776,14 @@ Guacamole.Client = function(tunnel) {
* handler will contain its own event handlers for received data. * handler will contain its own event handlers for received data.
* *
* @event * @event
* @param {Guacamole.InputStream} stream The stream that will receive data * @param {!Guacamole.InputStream} stream
* from the server. * The stream that will receive data from the server.
* @param {String} mimetype The mimetype of the file received. *
* @param {String} filename The name of the file received. * @param {!string} mimetype
* The mimetype of the file received.
*
* @param {!string} filename
* The name of the file received.
*/ */
this.onfile = null; this.onfile = null;
@@ -755,10 +793,10 @@ Guacamole.Client = function(tunnel) {
* requesting and handling data. * requesting and handling data.
* *
* @event * @event
* @param {Guacamole.Object} object * @param {!Guacamole.Object} object
* The created filesystem object. * The created filesystem object.
* *
* @param {String} name * @param {!string} name
* The name of the filesystem. * The name of the filesystem.
*/ */
this.onfilesystem = null; this.onfilesystem = null;
@@ -768,10 +806,14 @@ Guacamole.Client = function(tunnel) {
* handler will contain its own event handlers for received data; * handler will contain its own event handlers for received data;
* *
* @event * @event
* @param {Guacamole.InputStream} stream The stream that will receive data * @param {!Guacamole.InputStream} stream
* from the server. * The stream that will receive data from the server.
* @param {String} mimetype The mimetype of the data which will be received. *
* @param {String} name The name of the pipe. * @param {!string} mimetype
* The mimetype of the data which will be received.
*
* @param {!string} name
* The name of the pipe.
*/ */
this.onpipe = null; this.onpipe = null;
@@ -781,7 +823,7 @@ Guacamole.Client = function(tunnel) {
* continue, such as user credentials. * continue, such as user credentials.
* *
* @event * @event
* @param {String[]} parameters * @param {!string[]} parameters
* The names of the connection parameters that are required to be * The names of the connection parameters that are required to be
* provided for the connection to continue. * provided for the connection to continue.
*/ */
@@ -793,8 +835,8 @@ Guacamole.Client = function(tunnel) {
* has sent any results. * has sent any results.
* *
* @event * @event
* @param {Number} timestamp The timestamp associated with the sync * @param {!number} timestamp
* instruction. * The timestamp associated with the sync instruction.
*/ */
this.onsync = null; this.onsync = null;
@@ -804,10 +846,10 @@ Guacamole.Client = function(tunnel) {
* the default layer, and negative indices refer to buffers. * the default layer, and negative indices refer to buffers.
* *
* @private * @private
* @param {Number} index * @param {!number} index
* The index of the layer to retrieve. * The index of the layer to retrieve.
* *
* @return {Guacamole.Display.VisibleLayer|Guacamole.Layer} * @return {!(Guacamole.Display.VisibleLayer|Guacamole.Layer)}
* The layer having the given index. * The layer having the given index.
*/ */
var getLayer = function getLayer(index) { var getLayer = function getLayer(index) {
@@ -838,10 +880,10 @@ Guacamole.Client = function(tunnel) {
* Positive indices refer to visible layers, an index of zero refers to the * Positive indices refer to visible layers, an index of zero refers to the
* default layer, and negative indices refer to buffers. * default layer, and negative indices refer to buffers.
* *
* @param {Guacamole.Display.VisibleLayer|Guacamole.Layer} layer * @param {!(Guacamole.Display.VisibleLayer|Guacamole.Layer)} layer
* The layer whose index should be determined. * The layer whose index should be determined.
* *
* @returns {Number} * @returns {number}
* The index of the given layer, or null if no such layer is associated * The index of the given layer, or null if no such layer is associated
* with this client. * with this client.
*/ */
@@ -880,7 +922,9 @@ Guacamole.Client = function(tunnel) {
/** /**
* Handlers for all defined layer properties. * Handlers for all defined layer properties.
*
* @private * @private
* @type {!Object.<string, function>}
*/ */
var layerPropertyHandlers = { var layerPropertyHandlers = {
@@ -901,7 +945,9 @@ Guacamole.Client = function(tunnel) {
/** /**
* Handlers for all instruction opcodes receivable by a Guacamole protocol * Handlers for all instruction opcodes receivable by a Guacamole protocol
* client. * client.
*
* @private * @private
* @type {!Object.<string, function>}
*/ */
var instructionHandlers = { var instructionHandlers = {
@@ -1629,9 +1675,12 @@ Guacamole.Client = function(tunnel) {
* Connects the underlying tunnel of this Guacamole.Client, passing the * Connects the underlying tunnel of this Guacamole.Client, passing the
* given arbitrary data to the tunnel during the connection process. * given arbitrary data to the tunnel during the connection process.
* *
* @param data Arbitrary connection data to be sent to the underlying * @param {string} data
* tunnel during the connection process. * Arbitrary connection data to be sent to the underlying tunnel during
* @throws {Guacamole.Status} If an error occurs during connection. * the connection process.
*
* @throws {!Guacamole.Status}
* If an error occurs during connection.
*/ */
this.connect = function(data) { this.connect = function(data) {
@@ -1657,7 +1706,9 @@ Guacamole.Client = function(tunnel) {
/** /**
* Map of all Guacamole binary raster operations to transfer functions. * Map of all Guacamole binary raster operations to transfer functions.
*
* @private * @private
* @type {!Object.<number, function>}
*/ */
Guacamole.Client.DefaultTransferFunction = { Guacamole.Client.DefaultTransferFunction = {

View File

@@ -26,14 +26,19 @@ var Guacamole = Guacamole || {};
* given Guacamole.InputStream. * given Guacamole.InputStream.
* *
* @constructor * @constructor
* @param {Guacamole.InputStream} stream * @param {!Guacamole.InputStream} stream
* The stream that data will be read from. * The stream that data will be read from.
*
* @param {!string} mimetype
* The mimetype of the data being received.
*/ */
Guacamole.DataURIReader = function(stream, mimetype) { Guacamole.DataURIReader = function(stream, mimetype) {
/** /**
* Reference to this Guacamole.DataURIReader. * Reference to this Guacamole.DataURIReader.
*
* @private * @private
* @type {!Guacamole.DataURIReader}
*/ */
var guac_reader = this; var guac_reader = this;
@@ -41,7 +46,7 @@ Guacamole.DataURIReader = function(stream, mimetype) {
* Current data URI. * Current data URI.
* *
* @private * @private
* @type {String} * @type {!string}
*/ */
var uri = 'data:' + mimetype + ';base64,'; var uri = 'data:' + mimetype + ';base64,';
@@ -66,7 +71,7 @@ Guacamole.DataURIReader = function(stream, mimetype) {
* Returns the data URI of all data received through the underlying stream * Returns the data URI of all data received through the underlying stream
* thus far. * thus far.
* *
* @returns {String} * @returns {!string}
* The data URI of all data received through the underlying stream thus * The data URI of all data received through the underlying stream thus
* far. * far.
*/ */

File diff suppressed because it is too large Load Diff

View File

@@ -25,7 +25,7 @@ var Guacamole = Guacamole || {};
* specific to the event type. * specific to the event type.
* *
* @constructor * @constructor
* @param {String} type * @param {!string} type
* The unique name of this event type. * The unique name of this event type.
*/ */
Guacamole.Event = function Event(type) { Guacamole.Event = function Event(type) {
@@ -33,7 +33,7 @@ Guacamole.Event = function Event(type) {
/** /**
* The unique name of this event type. * The unique name of this event type.
* *
* @type {String} * @type {!string}
*/ */
this.type = type; this.type = type;
@@ -41,14 +41,14 @@ Guacamole.Event = function Event(type) {
* An arbitrary timestamp in milliseconds, indicating this event's * An arbitrary timestamp in milliseconds, indicating this event's
* position in time relative to other events. * position in time relative to other events.
* *
* @type {Number} * @type {!number}
*/ */
this.timestamp = new Date().getTime(); this.timestamp = new Date().getTime();
/** /**
* Returns the number of milliseconds elapsed since this event was created. * Returns the number of milliseconds elapsed since this event was created.
* *
* @return {Number} * @return {!number}
* The number of milliseconds elapsed since this event was created. * The number of milliseconds elapsed since this event was created.
*/ */
this.getAge = function getAge() { this.getAge = function getAge() {
@@ -69,7 +69,7 @@ Guacamole.Event = function Event(type) {
* <p> * <p>
* Unless overridden, this function does nothing. * Unless overridden, this function does nothing.
* *
* @param {Guacamole.Event.Target} eventTarget * @param {!Guacamole.Event.Target} eventTarget
* The {@link Guacamole.Event.Target} that emitted this event. * The {@link Guacamole.Event.Target} that emitted this event.
*/ */
this.invokeLegacyHandler = function invokeLegacyHandler(eventTarget) { this.invokeLegacyHandler = function invokeLegacyHandler(eventTarget) {
@@ -88,7 +88,7 @@ Guacamole.Event = function Event(type) {
* @constructor * @constructor
* @augments Guacamole.Event * @augments Guacamole.Event
* *
* @param {String} type * @param {!string} type
* The unique name of this event type. * The unique name of this event type.
* *
* @param {Event|Event[]} [events=[]] * @param {Event|Event[]} [events=[]]
@@ -137,7 +137,7 @@ Guacamole.Event.DOMEvent = function DOMEvent(type, events) {
* event. Invoking this function prevents the default behavior of the event and * event. Invoking this function prevents the default behavior of the event and
* stops any further propagation. * stops any further propagation.
* *
* @param {Event} event * @param {!Event} event
* The DOM event to cancel. * The DOM event to cancel.
*/ */
Guacamole.Event.DOMEvent.cancelEvent = function cancelEvent(event) { Guacamole.Event.DOMEvent.cancelEvent = function cancelEvent(event) {
@@ -163,10 +163,10 @@ Guacamole.Event.Target = function Target() {
* target. * target.
* *
* @callback Guacamole.Event.Target~listener * @callback Guacamole.Event.Target~listener
* @param {Guacamole.Event} event * @param {!Guacamole.Event} event
* The event that was dispatched. * The event that was dispatched.
* *
* @param {Guacamole.Event.Target} target * @param {!Guacamole.Event.Target} target
* The object that dispatched the event. * The object that dispatched the event.
*/ */
@@ -175,7 +175,7 @@ Guacamole.Event.Target = function Target() {
* to {@link Guacamole.Event.Targer#on on()}. * to {@link Guacamole.Event.Targer#on on()}.
* *
* @private * @private
* @type {Object.<String, Guacamole.Event.Target~listener[]>} * @type {!Object.<string, Guacamole.Event.Target~listener[]>}
*/ */
var listeners = {}; var listeners = {};
@@ -184,10 +184,10 @@ Guacamole.Event.Target = function Target() {
* the {@link Guacamole.Event#type type} property of {@link Guacamole.Event} * the {@link Guacamole.Event#type type} property of {@link Guacamole.Event}
* provided to {@link Guacamole.Event.Target#dispatch dispatch()}. * provided to {@link Guacamole.Event.Target#dispatch dispatch()}.
* *
* @param {String} type * @param {!string} type
* The unique name of this event type. * The unique name of this event type.
* *
* @param {Guacamole.Event.Target~listener} listener * @param {!Guacamole.Event.Target~listener} listener
* The function to invoke when an event having the given type is * The function to invoke when an event having the given type is
* dispatched. The {@link Guacamole.Event} object provided to * dispatched. The {@link Guacamole.Event} object provided to
* {@link Guacamole.Event.Target#dispatch dispatch()} will be passed to * {@link Guacamole.Event.Target#dispatch dispatch()} will be passed to
@@ -211,11 +211,11 @@ Guacamole.Event.Target = function Target() {
* Invoking this function is equivalent to manually invoking * Invoking this function is equivalent to manually invoking
* {@link Guacamole.Event.Target#on on()} for each of the provided types. * {@link Guacamole.Event.Target#on on()} for each of the provided types.
* *
* @param {String[]} types * @param {!string[]} types
* The unique names of the event types to associate with the given * The unique names of the event types to associate with the given
* listener. * listener.
* *
* @param {Guacamole.Event.Target~listener} listener * @param {!Guacamole.Event.Target~listener} listener
* The function to invoke when an event having any of the given types * The function to invoke when an event having any of the given types
* is dispatched. The {@link Guacamole.Event} object provided to * is dispatched. The {@link Guacamole.Event} object provided to
* {@link Guacamole.Event.Target#dispatch dispatch()} will be passed to * {@link Guacamole.Event.Target#dispatch dispatch()} will be passed to
@@ -232,7 +232,7 @@ Guacamole.Event.Target = function Target() {
* this Guacamole.Event.Target for that event's * this Guacamole.Event.Target for that event's
* {@link Guacamole.Event#type type}. * {@link Guacamole.Event#type type}.
* *
* @param {Guacamole.Event} event * @param {!Guacamole.Event} event
* The event to dispatch. * The event to dispatch.
*/ */
this.dispatch = function dispatch(event) { this.dispatch = function dispatch(event) {
@@ -258,16 +258,16 @@ Guacamole.Event.Target = function Target() {
* listener were registered, the first listener still registered will be * listener were registered, the first listener still registered will be
* removed. * removed.
* *
* @param {String} type * @param {!string} type
* The unique name of the event type handled by the listener being * The unique name of the event type handled by the listener being
* removed. * removed.
* *
* @param {Guacamole.Event.Target~listener} listener * @param {!Guacamole.Event.Target~listener} listener
* The listener function previously provided to * The listener function previously provided to
* {@link Guacamole.Event.Target#on on()}or * {@link Guacamole.Event.Target#on on()}or
* {@link Guacamole.Event.Target#onEach onEach()}. * {@link Guacamole.Event.Target#onEach onEach()}.
* *
* @returns {Boolean} * @returns {!boolean}
* true if the specified listener was removed, false otherwise. * true if the specified listener was removed, false otherwise.
*/ */
this.off = function off(type, listener) { this.off = function off(type, listener) {
@@ -298,16 +298,16 @@ Guacamole.Event.Target = function Target() {
* Invoking this function is equivalent to manually invoking * Invoking this function is equivalent to manually invoking
* {@link Guacamole.Event.Target#off off()} for each of the provided types. * {@link Guacamole.Event.Target#off off()} for each of the provided types.
* *
* @param {String[]} types * @param {!string[]} types
* The unique names of the event types handled by the listeners being * The unique names of the event types handled by the listeners being
* removed. * removed.
* *
* @param {Guacamole.Event.Target~listener} listener * @param {!Guacamole.Event.Target~listener} listener
* The listener function previously provided to * The listener function previously provided to
* {@link Guacamole.Event.Target#on on()} or * {@link Guacamole.Event.Target#on on()} or
* {@link Guacamole.Event.Target#onEach onEach()}. * {@link Guacamole.Event.Target#onEach onEach()}.
* *
* @returns {Boolean} * @returns {!boolean}
* true if any of the specified listeners were removed, false * true if any of the specified listeners were removed, false
* otherwise. * otherwise.
*/ */

View File

@@ -35,7 +35,7 @@ Guacamole.InputSink = function InputSink() {
* Reference to this instance of Guacamole.InputSink. * Reference to this instance of Guacamole.InputSink.
* *
* @private * @private
* @type {Guacamole.InputSink} * @type {!Guacamole.InputSink}
*/ */
var sink = this; var sink = this;
@@ -43,7 +43,7 @@ Guacamole.InputSink = function InputSink() {
* The underlying input field, styled to be invisible. * The underlying input field, styled to be invisible.
* *
* @private * @private
* @type {Element} * @type {!Element}
*/ */
var field = document.createElement('textarea'); var field = document.createElement('textarea');
field.style.position = 'fixed'; field.style.position = 'fixed';
@@ -100,7 +100,8 @@ Guacamole.InputSink = function InputSink() {
* Returns the underlying input field. This input field MUST be manually * Returns the underlying input field. This input field MUST be manually
* added to the DOM for the Guacamole.InputSink to have any effect. * added to the DOM for the Guacamole.InputSink to have any effect.
* *
* @returns {Element} * @returns {!Element}
* The underlying input field.
*/ */
this.getElement = function getElement() { this.getElement = function getElement() {
return field; return field;

View File

@@ -24,20 +24,26 @@ var Guacamole = Guacamole || {};
* transfer of files or other binary data. * transfer of files or other binary data.
* *
* @constructor * @constructor
* @param {Guacamole.Client} client The client owning this stream. * @param {!Guacamole.Client} client
* @param {Number} index The index of this stream. * The client owning this stream.
*
* @param {!number} index
* The index of this stream.
*/ */
Guacamole.InputStream = function(client, index) { Guacamole.InputStream = function(client, index) {
/** /**
* Reference to this stream. * Reference to this stream.
*
* @private * @private
* @type {!Guacamole.InputStream}
*/ */
var guac_stream = this; var guac_stream = this;
/** /**
* The index of this stream. * The index of this stream.
* @type {Number} *
* @type {!number}
*/ */
this.index = index; this.index = index;
@@ -45,7 +51,8 @@ Guacamole.InputStream = function(client, index) {
* Called when a blob of data is received. * Called when a blob of data is received.
* *
* @event * @event
* @param {String} data The received base64 data. * @param {!string} data
* The received base64 data.
*/ */
this.onblob = null; this.onblob = null;
@@ -59,9 +66,11 @@ Guacamole.InputStream = function(client, index) {
/** /**
* Acknowledges the receipt of a blob. * Acknowledges the receipt of a blob.
* *
* @param {String} message A human-readable message describing the error * @param {!string} message
* or status. * A human-readable message describing the error or status.
* @param {Number} code The error code, if any, or 0 for success. *
* @param {!number} code
* The error code, if any, or 0 for success.
*/ */
this.sendAck = function(message, code) { this.sendAck = function(message, code) {
client.sendAck(guac_stream.index, message, code); client.sendAck(guac_stream.index, message, code);

View File

@@ -37,13 +37,14 @@ Guacamole.IntegerPool = function() {
* Array of available integers. * Array of available integers.
* *
* @private * @private
* @type {Number[]} * @type {!number[]}
*/ */
var pool = []; var pool = [];
/** /**
* The next integer to return if no more integers remain. * The next integer to return if no more integers remain.
* @type {Number} *
* @type {!number}
*/ */
this.next_int = 0; this.next_int = 0;
@@ -51,7 +52,8 @@ Guacamole.IntegerPool = function() {
* Returns the next available integer in the pool. If possible, a previously * Returns the next available integer in the pool. If possible, a previously
* used integer will be returned. * used integer will be returned.
* *
* @return {Number} The next available integer. * @return {!number}
* The next available integer.
*/ */
this.next = function() { this.next = function() {
@@ -67,7 +69,8 @@ Guacamole.IntegerPool = function() {
/** /**
* Frees the given integer, allowing it to be reused. * Frees the given integer, allowing it to be reused.
* *
* @param {Number} integer The integer to free. * @param {!number} integer
* The integer to free.
*/ */
this.free = function(integer) { this.free = function(integer) {
pool.push(integer); pool.push(integer);

View File

@@ -35,7 +35,7 @@ Guacamole.JSONReader = function guacamoleJSONReader(stream) {
* Reference to this Guacamole.JSONReader. * Reference to this Guacamole.JSONReader.
* *
* @private * @private
* @type {Guacamole.JSONReader} * @type {!Guacamole.JSONReader}
*/ */
var guacReader = this; var guacReader = this;
@@ -43,7 +43,7 @@ Guacamole.JSONReader = function guacamoleJSONReader(stream) {
* Wrapped Guacamole.StringReader. * Wrapped Guacamole.StringReader.
* *
* @private * @private
* @type {Guacamole.StringReader} * @type {!Guacamole.StringReader}
*/ */
var stringReader = new Guacamole.StringReader(stream); var stringReader = new Guacamole.StringReader(stream);
@@ -51,14 +51,14 @@ Guacamole.JSONReader = function guacamoleJSONReader(stream) {
* All JSON read thus far. * All JSON read thus far.
* *
* @private * @private
* @type {String} * @type {!string}
*/ */
var json = ''; var json = '';
/** /**
* Returns the current length of this Guacamole.JSONReader, in characters. * Returns the current length of this Guacamole.JSONReader, in characters.
* *
* @return {!Number} * @return {!number}
* The current length of this Guacamole.JSONReader. * The current length of this Guacamole.JSONReader.
*/ */
this.getLength = function getLength() { this.getLength = function getLength() {
@@ -69,7 +69,7 @@ Guacamole.JSONReader = function guacamoleJSONReader(stream) {
* Returns the contents of this Guacamole.JSONReader as a JavaScript * Returns the contents of this Guacamole.JSONReader as a JavaScript
* object. * object.
* *
* @return {Object} * @return {object}
* The contents of this Guacamole.JSONReader, as parsed from the JSON * The contents of this Guacamole.JSONReader, as parsed from the JSON
* contents of the input stream. * contents of the input stream.
*/ */
@@ -99,7 +99,7 @@ Guacamole.JSONReader = function guacamoleJSONReader(stream) {
* Fired once for every blob of data received. * Fired once for every blob of data received.
* *
* @event * @event
* @param {Number} length * @param {!number} length
* The number of characters received. * The number of characters received.
*/ */
this.onprogress = null; this.onprogress = null;

View File

@@ -34,7 +34,9 @@ Guacamole.Keyboard = function Keyboard(element) {
/** /**
* Reference to this Guacamole.Keyboard. * Reference to this Guacamole.Keyboard.
*
* @private * @private
* @type {!Guacamole.Keyboard}
*/ */
var guac_keyboard = this; var guac_keyboard = this;
@@ -43,7 +45,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* instance with respect to other Guacamole.Keyboard instances. * instance with respect to other Guacamole.Keyboard instances.
* *
* @private * @private
* @type {Number} * @type {!number}
*/ */
var guacKeyboardID = Guacamole.Keyboard._nextID++; var guacKeyboardID = Guacamole.Keyboard._nextID++;
@@ -53,7 +55,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* *
* @private * @private
* @constant * @constant
* @type {String} * @type {!string}
*/ */
var EVENT_MARKER = '_GUAC_KEYBOARD_HANDLED_BY_' + guacKeyboardID; var EVENT_MARKER = '_GUAC_KEYBOARD_HANDLED_BY_' + guacKeyboardID;
@@ -62,9 +64,12 @@ Guacamole.Keyboard = function Keyboard(element) {
* with this Guacamole.Keyboard in focus. * with this Guacamole.Keyboard in focus.
* *
* @event * @event
* @param {Number} keysym The keysym of the key being pressed. * @param {!number} keysym
* @return {Boolean} true if the key event should be allowed through to the * The keysym of the key being pressed.
* browser, false otherwise. *
* @return {!boolean}
* true if the key event should be allowed through to the browser,
* false otherwise.
*/ */
this.onkeydown = null; this.onkeydown = null;
@@ -73,7 +78,8 @@ Guacamole.Keyboard = function Keyboard(element) {
* with this Guacamole.Keyboard in focus. * with this Guacamole.Keyboard in focus.
* *
* @event * @event
* @param {Number} keysym The keysym of the key being released. * @param {!number} keysym
* The keysym of the key being released.
*/ */
this.onkeyup = null; this.onkeyup = null;
@@ -83,14 +89,14 @@ Guacamole.Keyboard = function Keyboard(element) {
* reliably detect that quirk is to platform/browser-sniff. * reliably detect that quirk is to platform/browser-sniff.
* *
* @private * @private
* @type {Object.<String, Boolean>} * @type {!Object.<string, boolean>}
*/ */
var quirks = { var quirks = {
/** /**
* Whether keyup events are universally unreliable. * Whether keyup events are universally unreliable.
* *
* @type {Boolean} * @type {!boolean}
*/ */
keyupUnreliable: false, keyupUnreliable: false,
@@ -98,7 +104,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* Whether the Alt key is actually a modifier for typable keys and is * Whether the Alt key is actually a modifier for typable keys and is
* thus never used for keyboard shortcuts. * thus never used for keyboard shortcuts.
* *
* @type {Boolean} * @type {!boolean}
*/ */
altIsTypableOnly: false, altIsTypableOnly: false,
@@ -106,7 +112,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* Whether we can rely on receiving a keyup event for the Caps Lock * Whether we can rely on receiving a keyup event for the Caps Lock
* key. * key.
* *
* @type {Boolean} * @type {!boolean}
*/ */
capsLockKeyupUnreliable: false capsLockKeyupUnreliable: false
@@ -143,6 +149,9 @@ Guacamole.Keyboard = function Keyboard(element) {
/** /**
* Reference to this key event. * Reference to this key event.
*
* @private
* @type {!KeyEvent}
*/ */
var key_event = this; var key_event = this;
@@ -153,7 +162,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* this is the Unicode codepoint of the character that would be typed * this is the Unicode codepoint of the character that would be typed
* by the key pressed. * by the key pressed.
* *
* @type {Number} * @type {!number}
*/ */
this.keyCode = orig ? (orig.which || orig.keyCode) : 0; this.keyCode = orig ? (orig.which || orig.keyCode) : 0;
@@ -161,7 +170,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* The legacy DOM3 "keyIdentifier" of the key pressed, as defined at: * The legacy DOM3 "keyIdentifier" of the key pressed, as defined at:
* http://www.w3.org/TR/2009/WD-DOM-Level-3-Events-20090908/#events-Events-KeyboardEvent * http://www.w3.org/TR/2009/WD-DOM-Level-3-Events-20090908/#events-Events-KeyboardEvent
* *
* @type {String} * @type {!string}
*/ */
this.keyIdentifier = orig && orig.keyIdentifier; this.keyIdentifier = orig && orig.keyIdentifier;
@@ -169,7 +178,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* The standard name of the key pressed, as defined at: * The standard name of the key pressed, as defined at:
* http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent * http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent
* *
* @type {String} * @type {!string}
*/ */
this.key = orig && orig.key; this.key = orig && orig.key;
@@ -178,7 +187,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* defined at: * defined at:
* http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent * http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent
* *
* @type {Number} * @type {!number}
*/ */
this.location = orig ? getEventLocation(orig) : 0; this.location = orig ? getEventLocation(orig) : 0;
@@ -186,7 +195,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* The state of all local keyboard modifiers at the time this event was * The state of all local keyboard modifiers at the time this event was
* received. * received.
* *
* @type {Guacamole.Keyboard.ModifierState} * @type {!Guacamole.Keyboard.ModifierState}
*/ */
this.modifiers = orig ? Guacamole.Keyboard.ModifierState.fromKeyboardEvent(orig) : new Guacamole.Keyboard.ModifierState(); this.modifiers = orig ? Guacamole.Keyboard.ModifierState.fromKeyboardEvent(orig) : new Guacamole.Keyboard.ModifierState();
@@ -194,14 +203,14 @@ Guacamole.Keyboard = function Keyboard(element) {
* An arbitrary timestamp in milliseconds, indicating this event's * An arbitrary timestamp in milliseconds, indicating this event's
* position in time relative to other events. * position in time relative to other events.
* *
* @type {Number} * @type {!number}
*/ */
this.timestamp = new Date().getTime(); this.timestamp = new Date().getTime();
/** /**
* Whether the default action of this key event should be prevented. * Whether the default action of this key event should be prevented.
* *
* @type {Boolean} * @type {!boolean}
*/ */
this.defaultPrevented = false; this.defaultPrevented = false;
@@ -210,7 +219,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* by a best-effort guess using available event properties and keyboard * by a best-effort guess using available event properties and keyboard
* state. * state.
* *
* @type {Number} * @type {number}
*/ */
this.keysym = null; this.keysym = null;
@@ -219,7 +228,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* If false, the keysym may still be valid, but it's only a best guess, * If false, the keysym may still be valid, but it's only a best guess,
* and future key events may be a better source of information. * and future key events may be a better source of information.
* *
* @type {Boolean} * @type {!boolean}
*/ */
this.reliable = false; this.reliable = false;
@@ -227,8 +236,9 @@ Guacamole.Keyboard = function Keyboard(element) {
* Returns the number of milliseconds elapsed since this event was * Returns the number of milliseconds elapsed since this event was
* received. * received.
* *
* @return {!Number} The number of milliseconds elapsed since this * @return {!number}
* event was received. * The number of milliseconds elapsed since this event was
* received.
*/ */
this.getAge = function() { this.getAge = function() {
return new Date().getTime() - key_event.timestamp; return new Date().getTime() - key_event.timestamp;
@@ -244,7 +254,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* @private * @private
* @constructor * @constructor
* @augments Guacamole.Keyboard.KeyEvent * @augments Guacamole.Keyboard.KeyEvent
* @param {KeyboardEvent} orig * @param {!KeyboardEvent} orig
* The relevant DOM "keydown" event. * The relevant DOM "keydown" event.
*/ */
var KeydownEvent = function KeydownEvent(orig) { var KeydownEvent = function KeydownEvent(orig) {
@@ -260,7 +270,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* Whether the keyup following this keydown event is known to be * Whether the keyup following this keydown event is known to be
* reliable. If false, we cannot rely on the keyup event to occur. * reliable. If false, we cannot rely on the keyup event to occur.
* *
* @type {Boolean} * @type {!boolean}
*/ */
this.keyupReliable = !quirks.keyupUnreliable; this.keyupReliable = !quirks.keyupUnreliable;
@@ -311,7 +321,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* @private * @private
* @constructor * @constructor
* @augments Guacamole.Keyboard.KeyEvent * @augments Guacamole.Keyboard.KeyEvent
* @param {KeyboardEvent} orig * @param {!KeyboardEvent} orig
* The relevant DOM "keypress" event. * The relevant DOM "keypress" event.
*/ */
var KeypressEvent = function KeypressEvent(orig) { var KeypressEvent = function KeypressEvent(orig) {
@@ -337,7 +347,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* @private * @private
* @constructor * @constructor
* @augments Guacamole.Keyboard.KeyEvent * @augments Guacamole.Keyboard.KeyEvent
* @param {KeyboardEvent} orig * @param {!KeyboardEvent} orig
* The relevant DOM "keyup" event. * The relevant DOM "keyup" event.
*/ */
var KeyupEvent = function KeyupEvent(orig) { var KeyupEvent = function KeyupEvent(orig) {
@@ -367,14 +377,16 @@ Guacamole.Keyboard = function Keyboard(element) {
* KeydownEvent, KeypressEvent, and KeyupEvent classes. * KeydownEvent, KeypressEvent, and KeyupEvent classes.
* *
* @private * @private
* @type {KeyEvent[]} * @type {!KeyEvent[]}
*/ */
var eventLog = []; var eventLog = [];
/** /**
* Map of known JavaScript keycodes which do not map to typable characters * Map of known JavaScript keycodes which do not map to typable characters
* to their X11 keysym equivalents. * to their X11 keysym equivalents.
*
* @private * @private
* @type {!Object.<number, number[]>}
*/ */
var keycodeKeysyms = { var keycodeKeysyms = {
8: [0xFF08], // backspace 8: [0xFF08], // backspace
@@ -436,7 +448,9 @@ Guacamole.Keyboard = function Keyboard(element) {
/** /**
* Map of known JavaScript keyidentifiers which do not map to typable * Map of known JavaScript keyidentifiers which do not map to typable
* characters to their unshifted X11 keysym equivalents. * characters to their unshifted X11 keysym equivalents.
*
* @private * @private
* @type {!Object.<string, number[]>}
*/ */
var keyidentifier_keysym = { var keyidentifier_keysym = {
"Again": [0xFF66], "Again": [0xFF66],
@@ -551,7 +565,9 @@ Guacamole.Keyboard = function Keyboard(element) {
/** /**
* All keysyms which should not repeat when held down. * All keysyms which should not repeat when held down.
*
* @private * @private
* @type {!Object.<number, boolean>}
*/ */
var no_repeat = { var no_repeat = {
0xFE03: true, // ISO Level 3 Shift (AltGr) 0xFE03: true, // ISO Level 3 Shift (AltGr)
@@ -570,6 +586,8 @@ Guacamole.Keyboard = function Keyboard(element) {
/** /**
* All modifiers and their states. * All modifiers and their states.
*
* @type {!Guacamole.Keyboard.ModifierState}
*/ */
this.modifiers = new Guacamole.Keyboard.ModifierState(); this.modifiers = new Guacamole.Keyboard.ModifierState();
@@ -577,6 +595,8 @@ Guacamole.Keyboard = function Keyboard(element) {
* The state of every key, indexed by keysym. If a particular key is * The state of every key, indexed by keysym. If a particular key is
* pressed, the value of pressed for that keysym will be true. If a key * pressed, the value of pressed for that keysym will be true. If a key
* is not currently pressed, it will not be defined. * is not currently pressed, it will not be defined.
*
* @type {!Object.<number, boolean>}
*/ */
this.pressed = {}; this.pressed = {};
@@ -589,7 +609,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* of the key is explicitly known), it will not be defined. * of the key is explicitly known), it will not be defined.
* *
* @private * @private
* @tyle {Object.<Number, Boolean>} * @type {!Object.<number, boolean>}
*/ */
var implicitlyPressed = {}; var implicitlyPressed = {};
@@ -600,6 +620,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* is (theoretically) still pressed. * is (theoretically) still pressed.
* *
* @private * @private
* @type {!Object.<number, boolean>}
*/ */
var last_keydown_result = {}; var last_keydown_result = {};
@@ -608,20 +629,24 @@ Guacamole.Keyboard = function Keyboard(element) {
* fired. This object maps keycodes to keysyms. * fired. This object maps keycodes to keysyms.
* *
* @private * @private
* @type {Object.<Number, Number>} * @type {!Object.<number, number>}
*/ */
var recentKeysym = {}; var recentKeysym = {};
/** /**
* Timeout before key repeat starts. * Timeout before key repeat starts.
*
* @private * @private
* @type {number}
*/ */
var key_repeat_timeout = null; var key_repeat_timeout = null;
/** /**
* Interval which presses and releases the last key pressed while that * Interval which presses and releases the last key pressed while that
* key is still being held down. * key is still being held down.
*
* @private * @private
* @type {number}
*/ */
var key_repeat_interval = null; var key_repeat_interval = null;
@@ -631,11 +656,11 @@ Guacamole.Keyboard = function Keyboard(element) {
* undefined. * undefined.
* *
* @private * @private
* @param {Number[]} keysyms * @param {number[]} keysyms
* An array of keysyms, where the index of the keysym in the array is * An array of keysyms, where the index of the keysym in the array is
* the location value. * the location value.
* *
* @param {Number} location * @param {!number} location
* The location on the keyboard corresponding to the key pressed, as * The location on the keyboard corresponding to the key pressed, as
* defined at: http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent * defined at: http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent
*/ */
@@ -651,10 +676,10 @@ Guacamole.Keyboard = function Keyboard(element) {
* Returns true if the given keysym corresponds to a printable character, * Returns true if the given keysym corresponds to a printable character,
* false otherwise. * false otherwise.
* *
* @param {Number} keysym * @param {!number} keysym
* The keysym to check. * The keysym to check.
* *
* @returns {boolean} * @returns {!boolean}
* true if the given keysym corresponds to a printable character, * true if the given keysym corresponds to a printable character,
* false otherwise. * false otherwise.
*/ */
@@ -733,13 +758,13 @@ Guacamole.Keyboard = function Keyboard(element) {
* correct in all cases. * correct in all cases.
* *
* @private * @private
* @param {Number} keyCode * @param {!number} keyCode
* The keyCode from a browser keydown/keyup event. * The keyCode from a browser keydown/keyup event.
* *
* @param {String} keyIdentifier * @param {string} keyIdentifier
* The legacy keyIdentifier from a browser keydown/keyup event. * The legacy keyIdentifier from a browser keydown/keyup event.
* *
* @returns {boolean} * @returns {!boolean}
* true if the keyIdentifier looks sane, false if the keyIdentifier * true if the keyIdentifier looks sane, false if the keyIdentifier
* appears incorrectly derived or is missing entirely. * appears incorrectly derived or is missing entirely.
*/ */
@@ -776,8 +801,11 @@ Guacamole.Keyboard = function Keyboard(element) {
* not a modifier. The return value of this function depends on the * not a modifier. The return value of this function depends on the
* return value of the keydown event handler, if any. * return value of the keydown event handler, if any.
* *
* @param {Number} keysym The keysym of the key to press. * @param {number} keysym
* @return {Boolean} true if event should NOT be canceled, false otherwise. * The keysym of the key to press.
*
* @return {boolean}
* true if event should NOT be canceled, false otherwise.
*/ */
this.press = function(keysym) { this.press = function(keysym) {
@@ -820,7 +848,8 @@ Guacamole.Keyboard = function Keyboard(element) {
/** /**
* Marks a key as released, firing the keyup event if registered. * Marks a key as released, firing the keyup event if registered.
* *
* @param {Number} keysym The keysym of the key to release. * @param {number} keysym
* The keysym of the key to release.
*/ */
this.release = function(keysym) { this.release = function(keysym) {
@@ -847,7 +876,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* Presses and releases the keys necessary to type the given string of * Presses and releases the keys necessary to type the given string of
* text. * text.
* *
* @param {String} str * @param {!string} str
* The string to type. * The string to type.
*/ */
this.type = function type(str) { this.type = function type(str) {
@@ -889,14 +918,14 @@ Guacamole.Keyboard = function Keyboard(element) {
* releasing keysyms. * releasing keysyms.
* *
* @private * @private
* @param {string} modifier * @param {!string} modifier
* The name of the {@link Guacamole.Keyboard.ModifierState} property * The name of the {@link Guacamole.Keyboard.ModifierState} property
* being updated. * being updated.
* *
* @param {number[]} keysyms * @param {!number[]} keysyms
* The keysyms which represent the modifier being updated. * The keysyms which represent the modifier being updated.
* *
* @param {KeyEvent} keyEvent * @param {!KeyEvent} keyEvent
* Guacamole's current best interpretation of the key event being * Guacamole's current best interpretation of the key event being
* processed. * processed.
*/ */
@@ -954,7 +983,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* This function pays no attention to keycodes. * This function pays no attention to keycodes.
* *
* @private * @private
* @param {KeyEvent} keyEvent * @param {!KeyEvent} keyEvent
* Guacamole's current best interpretation of the key event being * Guacamole's current best interpretation of the key event being
* processed. * processed.
*/ */
@@ -1002,7 +1031,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* inspection of other key events. * inspection of other key events.
* *
* @private * @private
* @returns {boolean} * @returns {!boolean}
* true if all currently pressed keys were implicitly pressed, false * true if all currently pressed keys were implicitly pressed, false
* otherwise. * otherwise.
*/ */
@@ -1023,8 +1052,8 @@ Guacamole.Keyboard = function Keyboard(element) {
* can be). * can be).
* *
* @private * @private
* @return {Boolean} Whether the default action of the latest event should * @return {boolean}
* be prevented. * Whether the default action of the latest event should be prevented.
*/ */
function interpret_events() { function interpret_events() {
@@ -1054,7 +1083,8 @@ Guacamole.Keyboard = function Keyboard(element) {
* looks like a key that may require AltGr. * looks like a key that may require AltGr.
* *
* @private * @private
* @param {Number} keysym The key that was just pressed. * @param {!number} keysym
* The key that was just pressed.
*/ */
var release_simulated_altgr = function release_simulated_altgr(keysym) { var release_simulated_altgr = function release_simulated_altgr(keysym) {
@@ -1214,11 +1244,11 @@ Guacamole.Keyboard = function Keyboard(element) {
* have the same keycode, such as left shift vs. right shift. * have the same keycode, such as left shift vs. right shift.
* *
* @private * @private
* @param {KeyboardEvent} e * @param {!KeyboardEvent} e
* A JavaScript keyboard event, as received through the DOM via a * A JavaScript keyboard event, as received through the DOM via a
* "keydown", "keyup", or "keypress" handler. * "keydown", "keyup", or "keypress" handler.
* *
* @returns {Number} * @returns {!number}
* The location of the key event on the keyboard, as defined at: * The location of the key event on the keyboard, as defined at:
* http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent * http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent
*/ */
@@ -1242,10 +1272,10 @@ Guacamole.Keyboard = function Keyboard(element) {
* Guacamole.Keyboard. If the Event has already been marked as handled, * Guacamole.Keyboard. If the Event has already been marked as handled,
* false is returned. * false is returned.
* *
* @param {Event} e * @param {!Event} e
* The Event to mark. * The Event to mark.
* *
* @returns {boolean} * @returns {!boolean}
* true if the given Event was successfully marked, false if the given * true if the given Event was successfully marked, false if the given
* Event was already marked. * Event was already marked.
*/ */
@@ -1267,7 +1297,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* events signalled through this Guacamole.Keyboard's onkeydown and * events signalled through this Guacamole.Keyboard's onkeydown and
* onkeyup handlers. * onkeyup handlers.
* *
* @param {Element|Document} element * @param {!(Element|Document)} element
* The Element to attach event listeners to for the sake of handling * The Element to attach event listeners to for the sake of handling
* key or input events. * key or input events.
*/ */
@@ -1339,7 +1369,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* events is suspended, as such events may conflict with input events. * events is suspended, as such events may conflict with input events.
* *
* @private * @private
* @param {InputEvent} e * @param {!InputEvent} e
* The "input" event to handle. * The "input" event to handle.
*/ */
var handleInput = function handleInput(e) { var handleInput = function handleInput(e) {
@@ -1365,7 +1395,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* with composition events. * with composition events.
* *
* @private * @private
* @param {CompositionEvent} e * @param {!CompositionEvent} e
* The "compositionend" event to handle. * The "compositionend" event to handle.
*/ */
var handleComposition = function handleComposition(e) { var handleComposition = function handleComposition(e) {
@@ -1401,7 +1431,7 @@ Guacamole.Keyboard = function Keyboard(element) {
* instance. * instance.
* *
* @private * @private
* @type {Number} * @type {!number}
*/ */
Guacamole.Keyboard._nextID = 0; Guacamole.Keyboard._nextID = 0;
@@ -1413,31 +1443,36 @@ Guacamole.Keyboard.ModifierState = function() {
/** /**
* Whether shift is currently pressed. * Whether shift is currently pressed.
* @type {Boolean} *
* @type {!boolean}
*/ */
this.shift = false; this.shift = false;
/** /**
* Whether ctrl is currently pressed. * Whether ctrl is currently pressed.
* @type {Boolean} *
* @type {!boolean}
*/ */
this.ctrl = false; this.ctrl = false;
/** /**
* Whether alt is currently pressed. * Whether alt is currently pressed.
* @type {Boolean} *
* @type {!boolean}
*/ */
this.alt = false; this.alt = false;
/** /**
* Whether meta (apple key) is currently pressed. * Whether meta (apple key) is currently pressed.
* @type {Boolean} *
* @type {!boolean}
*/ */
this.meta = false; this.meta = false;
/** /**
* Whether hyper (windows key) is currently pressed. * Whether hyper (windows key) is currently pressed.
* @type {Boolean} *
* @type {!boolean}
*/ */
this.hyper = false; this.hyper = false;
@@ -1446,9 +1481,11 @@ Guacamole.Keyboard.ModifierState = function() {
/** /**
* Returns the modifier state applicable to the keyboard event given. * Returns the modifier state applicable to the keyboard event given.
* *
* @param {KeyboardEvent} e The keyboard event to read. * @param {!KeyboardEvent} e
* @returns {!Guacamole.Keyboard.ModifierState} The current state of keyboard * The keyboard event to read.
* modifiers. *
* @returns {!Guacamole.Keyboard.ModifierState}
* The current state of keyboard modifiers.
*/ */
Guacamole.Keyboard.ModifierState.fromKeyboardEvent = function(e) { Guacamole.Keyboard.ModifierState.fromKeyboardEvent = function(e) {

View File

@@ -28,17 +28,21 @@ var Guacamole = Guacamole || {};
* *
* @constructor * @constructor
* *
* @param {Number} width The width of the Layer, in pixels. The canvas element * @param {!number} width
* backing this Layer will be given this width. * The width of the Layer, in pixels. The canvas element backing this Layer
* will be given this width.
* *
* @param {Number} height The height of the Layer, in pixels. The canvas element * @param {!number} height
* backing this Layer will be given this height. * The height of the Layer, in pixels. The canvas element backing this
* Layer will be given this height.
*/ */
Guacamole.Layer = function(width, height) { Guacamole.Layer = function(width, height) {
/** /**
* Reference to this Layer. * Reference to this Layer.
*
* @private * @private
* @type {!Guacamole.Layer}
*/ */
var layer = this; var layer = this;
@@ -49,19 +53,23 @@ Guacamole.Layer = function(width, height) {
* *
* @private * @private
* @constant * @constant
* @type Number * @type {!number}
*/ */
var CANVAS_SIZE_FACTOR = 64; var CANVAS_SIZE_FACTOR = 64;
/** /**
* The canvas element backing this Layer. * The canvas element backing this Layer.
*
* @private * @private
* @type {!HTMLCanvasElement}
*/ */
var canvas = document.createElement("canvas"); var canvas = document.createElement("canvas");
/** /**
* The 2D display context of the canvas element backing this Layer. * The 2D display context of the canvas element backing this Layer.
*
* @private * @private
* @type {!CanvasRenderingContext2D}
*/ */
var context = canvas.getContext("2d"); var context = canvas.getContext("2d");
context.save(); context.save();
@@ -72,14 +80,16 @@ Guacamole.Layer = function(width, height) {
* false. * false.
* *
* @private * @private
* @type Boolean * @type {!boolean}
*/ */
var empty = true; var empty = true;
/** /**
* Whether a new path should be started with the next path drawing * Whether a new path should be started with the next path drawing
* operations. * operations.
*
* @private * @private
* @type {!boolean}
*/ */
var pathClosed = true; var pathClosed = true;
@@ -91,13 +101,16 @@ Guacamole.Layer = function(width, height) {
* initial state. * initial state.
* *
* @private * @private
* @type {!number}
*/ */
var stackSize = 0; var stackSize = 0;
/** /**
* Map of all Guacamole channel masks to HTML5 canvas composite operation * Map of all Guacamole channel masks to HTML5 canvas composite operation
* names. Not all channel mask combinations are currently implemented. * names. Not all channel mask combinations are currently implemented.
*
* @private * @private
* @type {!Object.<number, string>}
*/ */
var compositeOperation = { var compositeOperation = {
/* 0x0 NOT IMPLEMENTED */ /* 0x0 NOT IMPLEMENTED */
@@ -123,10 +136,10 @@ Guacamole.Layer = function(width, height) {
* be used internally. * be used internally.
* *
* @private * @private
* @param {Number} [newWidth=0] * @param {number} [newWidth=0]
* The new width to assign to this Layer. * The new width to assign to this Layer.
* *
* @param {Number} [newHeight=0] * @param {number} [newHeight=0]
* The new height to assign to this Layer. * The new height to assign to this Layer.
*/ */
var resize = function resize(newWidth, newHeight) { var resize = function resize(newWidth, newHeight) {
@@ -201,12 +214,17 @@ Guacamole.Layer = function(width, height) {
* coordinate space, the canvas is left unchanged. * coordinate space, the canvas is left unchanged.
* *
* @private * @private
* @param {Number} x The X coordinate of the upper-left corner of the * @param {!number} x
* rectangle to fit. * The X coordinate of the upper-left corner of the rectangle to fit.
* @param {Number} y The Y coordinate of the upper-left corner of the *
* rectangle to fit. * @param {!number} y
* @param {Number} w The width of the the rectangle to fit. * The Y coordinate of the upper-left corner of the rectangle to fit.
* @param {Number} h The height of the the rectangle to fit. *
* @param {!number} w
* The width of the rectangle to fit.
*
* @param {!number} h
* The height of the rectangle to fit.
*/ */
function fitRect(x, y, w, h) { function fitRect(x, y, w, h) {
@@ -249,20 +267,22 @@ Guacamole.Layer = function(width, height) {
* layer.autosize = true; * layer.autosize = true;
* }); * });
* *
* @type {Boolean} * @type {!boolean}
* @default false * @default false
*/ */
this.autosize = false; this.autosize = false;
/** /**
* The current width of this layer. * The current width of this layer.
* @type {Number} *
* @type {!number}
*/ */
this.width = width; this.width = width;
/** /**
* The current height of this layer. * The current height of this layer.
* @type {Number} *
* @type {!number}
*/ */
this.height = height; this.height = height;
@@ -307,8 +327,11 @@ Guacamole.Layer = function(width, height) {
* is only attempted if the new size provided is actually different from * is only attempted if the new size provided is actually different from
* the current size. * the current size.
* *
* @param {Number} newWidth The new width to assign to this Layer. * @param {!number} newWidth
* @param {Number} newHeight The new height to assign to this Layer. * The new width to assign to this Layer.
*
* @param {!number} newHeight
* The new height to assign to this Layer.
*/ */
this.resize = function(newWidth, newHeight) { this.resize = function(newWidth, newHeight) {
if (newWidth !== layer.width || newHeight !== layer.height) if (newWidth !== layer.width || newHeight !== layer.height)
@@ -319,13 +342,13 @@ Guacamole.Layer = function(width, height) {
* Draws the specified image at the given coordinates. The image specified * Draws the specified image at the given coordinates. The image specified
* must already be loaded. * must already be loaded.
* *
* @param {Number} x * @param {!number} x
* The destination X coordinate. * The destination X coordinate.
* *
* @param {Number} y * @param {!number} y
* The destination Y coordinate. * The destination Y coordinate.
* *
* @param {CanvasImageSource} image * @param {!CanvasImageSource} image
* The image to draw. Note that this is not a URL. * The image to draw. Note that this is not a URL.
*/ */
this.drawImage = function(x, y, image) { this.drawImage = function(x, y, image) {
@@ -338,22 +361,34 @@ Guacamole.Layer = function(width, height) {
* Transfer a rectangle of image data from one Layer to this Layer using the * Transfer a rectangle of image data from one Layer to this Layer using the
* specified transfer function. * specified transfer function.
* *
* @param {Guacamole.Layer} srcLayer The Layer to copy image data from. * @param {!Guacamole.Layer} srcLayer
* @param {Number} srcx The X coordinate of the upper-left corner of the * The Layer to copy image data from.
* rectangle within the source Layer's coordinate *
* space to copy data from. * @param {!number} srcx
* @param {Number} srcy The Y coordinate of the upper-left corner of the * The X coordinate of the upper-left corner of the rectangle within
* rectangle within the source Layer's coordinate * the source Layer's coordinate space to copy data from.
* space to copy data from. *
* @param {Number} srcw The width of the rectangle within the source Layer's * @param {!number} srcy
* coordinate space to copy data from. * The Y coordinate of the upper-left corner of the rectangle within
* @param {Number} srch The height of the rectangle within the source * the source Layer's coordinate space to copy data from.
* Layer's coordinate space to copy data from. *
* @param {Number} x The destination X coordinate. * @param {!number} srcw
* @param {Number} y The destination Y coordinate. * The width of the rectangle within the source Layer's coordinate
* @param {Function} transferFunction The transfer function to use to * space to copy data from.
* transfer data from source to *
* destination. * @param {!number} srch
* The height of the rectangle within the source Layer's coordinate
* space to copy data from.
*
* @param {!number} x
* The destination X coordinate.
*
* @param {!number} y
* The destination Y coordinate.
*
* @param {!function} transferFunction
* The transfer function to use to transfer data from source to
* destination.
*/ */
this.transfer = function(srcLayer, srcx, srcy, srcw, srch, x, y, transferFunction) { this.transfer = function(srcLayer, srcx, srcy, srcw, srch, x, y, transferFunction) {
@@ -418,19 +453,30 @@ Guacamole.Layer = function(width, height) {
* Put a rectangle of image data from one Layer to this Layer directly * Put a rectangle of image data from one Layer to this Layer directly
* without performing any alpha blending. Simply copy the data. * without performing any alpha blending. Simply copy the data.
* *
* @param {Guacamole.Layer} srcLayer The Layer to copy image data from. * @param {!Guacamole.Layer} srcLayer
* @param {Number} srcx The X coordinate of the upper-left corner of the * The Layer to copy image data from.
* rectangle within the source Layer's coordinate *
* space to copy data from. * @param {!number} srcx
* @param {Number} srcy The Y coordinate of the upper-left corner of the * The X coordinate of the upper-left corner of the rectangle within
* rectangle within the source Layer's coordinate * the source Layer's coordinate space to copy data from.
* space to copy data from. *
* @param {Number} srcw The width of the rectangle within the source Layer's * @param {!number} srcy
* coordinate space to copy data from. * The Y coordinate of the upper-left corner of the rectangle within
* @param {Number} srch The height of the rectangle within the source * the source Layer's coordinate space to copy data from.
* Layer's coordinate space to copy data from. *
* @param {Number} x The destination X coordinate. * @param {!number} srcw
* @param {Number} y The destination Y coordinate. * The width of the rectangle within the source Layer's coordinate
* space to copy data from.
*
* @param {!number} srch
* The height of the rectangle within the source Layer's coordinate
* space to copy data from.
*
* @param {!number} x
* The destination X coordinate.
*
* @param {!number} y
* The destination Y coordinate.
*/ */
this.put = function(srcLayer, srcx, srcy, srcw, srch, x, y) { this.put = function(srcLayer, srcx, srcy, srcw, srch, x, y) {
@@ -465,19 +511,30 @@ Guacamole.Layer = function(width, height) {
* function was called are complete. This operation will not alter the * function was called are complete. This operation will not alter the
* size of the source Layer even if its autosize property is set to true. * size of the source Layer even if its autosize property is set to true.
* *
* @param {Guacamole.Layer} srcLayer The Layer to copy image data from. * @param {!Guacamole.Layer} srcLayer
* @param {Number} srcx The X coordinate of the upper-left corner of the * The Layer to copy image data from.
* rectangle within the source Layer's coordinate *
* space to copy data from. * @param {!number} srcx
* @param {Number} srcy The Y coordinate of the upper-left corner of the * The X coordinate of the upper-left corner of the rectangle within
* rectangle within the source Layer's coordinate * the source Layer's coordinate space to copy data from.
* space to copy data from. *
* @param {Number} srcw The width of the rectangle within the source Layer's * @param {!number} srcy
* coordinate space to copy data from. * The Y coordinate of the upper-left corner of the rectangle within
* @param {Number} srch The height of the rectangle within the source * the source Layer's coordinate space to copy data from.
* Layer's coordinate space to copy data from. *
* @param {Number} x The destination X coordinate. * @param {!number} srcw
* @param {Number} y The destination Y coordinate. * The width of the rectangle within the source Layer's coordinate
* space to copy data from.
*
* @param {!number} srch
* The height of the rectangle within the source Layer's coordinate
* space to copy data from.
*
* @param {!number} x
* The destination X coordinate.
*
* @param {!number} y
* The destination Y coordinate.
*/ */
this.copy = function(srcLayer, srcx, srcy, srcw, srch, x, y) { this.copy = function(srcLayer, srcx, srcy, srcw, srch, x, y) {
@@ -505,8 +562,11 @@ Guacamole.Layer = function(width, height) {
/** /**
* Starts a new path at the specified point. * Starts a new path at the specified point.
* *
* @param {Number} x The X coordinate of the point to draw. * @param {!number} x
* @param {Number} y The Y coordinate of the point to draw. * The X coordinate of the point to draw.
*
* @param {!number} y
* The Y coordinate of the point to draw.
*/ */
this.moveTo = function(x, y) { this.moveTo = function(x, y) {
@@ -524,8 +584,11 @@ Guacamole.Layer = function(width, height) {
/** /**
* Add the specified line to the current path. * Add the specified line to the current path.
* *
* @param {Number} x The X coordinate of the endpoint of the line to draw. * @param {!number} x
* @param {Number} y The Y coordinate of the endpoint of the line to draw. * The X coordinate of the endpoint of the line to draw.
*
* @param {!number} y
* The Y coordinate of the endpoint of the line to draw.
*/ */
this.lineTo = function(x, y) { this.lineTo = function(x, y) {
@@ -543,15 +606,25 @@ Guacamole.Layer = function(width, height) {
/** /**
* Add the specified arc to the current path. * Add the specified arc to the current path.
* *
* @param {Number} x The X coordinate of the center of the circle which * @param {!number} x
* will contain the arc. * The X coordinate of the center of the circle which will contain the
* @param {Number} y The Y coordinate of the center of the circle which * arc.
* will contain the arc. *
* @param {Number} radius The radius of the circle. * @param {!number} y
* @param {Number} startAngle The starting angle of the arc, in radians. * The Y coordinate of the center of the circle which will contain the
* @param {Number} endAngle The ending angle of the arc, in radians. * arc.
* @param {Boolean} negative Whether the arc should be drawn in order of *
* decreasing angle. * @param {!number} radius
* The radius of the circle.
*
* @param {!number} startAngle
* The starting angle of the arc, in radians.
*
* @param {!number} endAngle
* The ending angle of the arc, in radians.
*
* @param {!boolean} negative
* Whether the arc should be drawn in order of decreasing angle.
*/ */
this.arc = function(x, y, radius, startAngle, endAngle, negative) { this.arc = function(x, y, radius, startAngle, endAngle, negative) {
@@ -569,12 +642,23 @@ Guacamole.Layer = function(width, height) {
/** /**
* Starts a new path at the specified point. * Starts a new path at the specified point.
* *
* @param {Number} cp1x The X coordinate of the first control point. * @param {!number} cp1x
* @param {Number} cp1y The Y coordinate of the first control point. * The X coordinate of the first control point.
* @param {Number} cp2x The X coordinate of the second control point. *
* @param {Number} cp2y The Y coordinate of the second control point. * @param {!number} cp1y
* @param {Number} x The X coordinate of the endpoint of the curve. * The Y coordinate of the first control point.
* @param {Number} y The Y coordinate of the endpoint of the curve. *
* @param {!number} cp2x
* The X coordinate of the second control point.
*
* @param {!number} cp2y
* The Y coordinate of the second control point.
*
* @param {!number} x
* The X coordinate of the endpoint of the curve.
*
* @param {!number} y
* The Y coordinate of the endpoint of the curve.
*/ */
this.curveTo = function(cp1x, cp1y, cp2x, cp2y, x, y) { this.curveTo = function(cp1x, cp1y, cp2x, cp2y, x, y) {
@@ -601,12 +685,17 @@ Guacamole.Layer = function(width, height) {
/** /**
* Add the specified rectangle to the current path. * Add the specified rectangle to the current path.
* *
* @param {Number} x The X coordinate of the upper-left corner of the * @param {!number} x
* rectangle to draw. * The X coordinate of the upper-left corner of the rectangle to draw.
* @param {Number} y The Y coordinate of the upper-left corner of the *
* rectangle to draw. * @param {!number} y
* @param {Number} w The width of the rectangle to draw. * The Y coordinate of the upper-left corner of the rectangle to draw.
* @param {Number} h The height of the rectangle to draw. *
* @param {!number} w
* The width of the rectangle to draw.
*
* @param {!number} h
* The height of the rectangle to draw.
*/ */
this.rect = function(x, y, w, h) { this.rect = function(x, y, w, h) {
@@ -643,15 +732,26 @@ Guacamole.Layer = function(width, height) {
* for other operations (such as clip()) but a new path will be started * for other operations (such as clip()) but a new path will be started
* once a path drawing operation (path() or rect()) is used. * once a path drawing operation (path() or rect()) is used.
* *
* @param {String} cap The line cap style. Can be "round", "square", * @param {!string} cap
* or "butt". * The line cap style. Can be "round", "square", or "butt".
* @param {String} join The line join style. Can be "round", "bevel", *
* or "miter". * @param {!string} join
* @param {Number} thickness The line thickness in pixels. * The line join style. Can be "round", "bevel", or "miter".
* @param {Number} r The red component of the color to fill. *
* @param {Number} g The green component of the color to fill. * @param {!number} thickness
* @param {Number} b The blue component of the color to fill. * The line thickness in pixels.
* @param {Number} a The alpha component of the color to fill. *
* @param {!number} r
* The red component of the color to fill.
*
* @param {!number} g
* The green component of the color to fill.
*
* @param {!number} b
* The blue component of the color to fill.
*
* @param {!number} a
* The alpha component of the color to fill.
*/ */
this.strokeColor = function(cap, join, thickness, r, g, b, a) { this.strokeColor = function(cap, join, thickness, r, g, b, a) {
@@ -674,10 +774,17 @@ Guacamole.Layer = function(width, height) {
* for other operations (such as clip()) but a new path will be started * for other operations (such as clip()) but a new path will be started
* once a path drawing operation (path() or rect()) is used. * once a path drawing operation (path() or rect()) is used.
* *
* @param {Number} r The red component of the color to fill. * @param {!number} r
* @param {Number} g The green component of the color to fill. * The red component of the color to fill.
* @param {Number} b The blue component of the color to fill. *
* @param {Number} a The alpha component of the color to fill. * @param {!number} g
* The green component of the color to fill.
*
* @param {!number} b
* The blue component of the color to fill.
*
* @param {!number} a
* The alpha component of the color to fill.
*/ */
this.fillColor = function(r, g, b, a) { this.fillColor = function(r, g, b, a) {
@@ -698,13 +805,17 @@ Guacamole.Layer = function(width, height) {
* for other operations (such as clip()) but a new path will be started * for other operations (such as clip()) but a new path will be started
* once a path drawing operation (path() or rect()) is used. * once a path drawing operation (path() or rect()) is used.
* *
* @param {String} cap The line cap style. Can be "round", "square", * @param {!string} cap
* or "butt". * The line cap style. Can be "round", "square", or "butt".
* @param {String} join The line join style. Can be "round", "bevel", *
* or "miter". * @param {!string} join
* @param {Number} thickness The line thickness in pixels. * The line join style. Can be "round", "bevel", or "miter".
* @param {Guacamole.Layer} srcLayer The layer to use as a repeating pattern *
* within the stroke. * @param {!number} thickness
* The line thickness in pixels.
*
* @param {!Guacamole.Layer} srcLayer
* The layer to use as a repeating pattern within the stroke.
*/ */
this.strokeLayer = function(cap, join, thickness, srcLayer) { this.strokeLayer = function(cap, join, thickness, srcLayer) {
@@ -731,8 +842,8 @@ Guacamole.Layer = function(width, height) {
* for other operations (such as clip()) but a new path will be started * for other operations (such as clip()) but a new path will be started
* once a path drawing operation (path() or rect()) is used. * once a path drawing operation (path() or rect()) is used.
* *
* @param {Guacamole.Layer} srcLayer The layer to use as a repeating pattern * @param {!Guacamole.Layer} srcLayer
* within the fill. * The layer to use as a repeating pattern within the fill.
*/ */
this.fillLayer = function(srcLayer) { this.fillLayer = function(srcLayer) {
@@ -799,12 +910,23 @@ Guacamole.Layer = function(width, height) {
* Sets the given affine transform (defined with six values from the * Sets the given affine transform (defined with six values from the
* transform's matrix). * transform's matrix).
* *
* @param {Number} a The first value in the affine transform's matrix. * @param {!number} a
* @param {Number} b The second value in the affine transform's matrix. * The first value in the affine transform's matrix.
* @param {Number} c The third value in the affine transform's matrix. *
* @param {Number} d The fourth value in the affine transform's matrix. * @param {!number} b
* @param {Number} e The fifth value in the affine transform's matrix. * The second value in the affine transform's matrix.
* @param {Number} f The sixth value in the affine transform's matrix. *
* @param {!number} c
* The third value in the affine transform's matrix.
*
* @param {!number} d
* The fourth value in the affine transform's matrix.
*
* @param {!number} e
* The fifth value in the affine transform's matrix.
*
* @param {!number} f
* The sixth value in the affine transform's matrix.
*/ */
this.setTransform = function(a, b, c, d, e, f) { this.setTransform = function(a, b, c, d, e, f) {
context.setTransform( context.setTransform(
@@ -818,12 +940,23 @@ Guacamole.Layer = function(width, height) {
* Applies the given affine transform (defined with six values from the * Applies the given affine transform (defined with six values from the
* transform's matrix). * transform's matrix).
* *
* @param {Number} a The first value in the affine transform's matrix. * @param {!number} a
* @param {Number} b The second value in the affine transform's matrix. * The first value in the affine transform's matrix.
* @param {Number} c The third value in the affine transform's matrix. *
* @param {Number} d The fourth value in the affine transform's matrix. * @param {!number} b
* @param {Number} e The fifth value in the affine transform's matrix. * The second value in the affine transform's matrix.
* @param {Number} f The sixth value in the affine transform's matrix. *
* @param {!number} c
* The third value in the affine transform's matrix.
*
* @param {!number} d
* The fourth value in the affine transform's matrix.
*
* @param {!number} e
* The fifth value in the affine transform's matrix.
*
* @param {!number} f
* The sixth value in the affine transform's matrix.
*/ */
this.transform = function(a, b, c, d, e, f) { this.transform = function(a, b, c, d, e, f) {
context.transform( context.transform(
@@ -842,8 +975,8 @@ Guacamole.Layer = function(width, height) {
* destination where source transparent, and destination where source * destination where source transparent, and destination where source
* opaque. * opaque.
* *
* @param {Number} mask The channel mask for future operations on this * @param {!number} mask
* Layer. * The channel mask for future operations on this Layer.
*/ */
this.setChannelMask = function(mask) { this.setChannelMask = function(mask) {
context.globalCompositeOperation = compositeOperation[mask]; context.globalCompositeOperation = compositeOperation[mask];
@@ -855,8 +988,8 @@ Guacamole.Layer = function(width, height) {
* width. If this ratio is exceeded, the miter will not be drawn for that * width. If this ratio is exceeded, the miter will not be drawn for that
* joint of the path. * joint of the path.
* *
* @param {Number} limit The miter limit for stroke operations using the * @param {!number} limit
* miter join. * The miter limit for stroke operations using the miter join.
*/ */
this.setMiterLimit = function(limit) { this.setMiterLimit = function(limit) {
context.miterLimit = limit; context.miterLimit = limit;
@@ -874,31 +1007,43 @@ Guacamole.Layer = function(width, height) {
/** /**
* Channel mask for the composite operation "rout". * Channel mask for the composite operation "rout".
*
* @type {!number}
*/ */
Guacamole.Layer.ROUT = 0x2; Guacamole.Layer.ROUT = 0x2;
/** /**
* Channel mask for the composite operation "atop". * Channel mask for the composite operation "atop".
*
* @type {!number}
*/ */
Guacamole.Layer.ATOP = 0x6; Guacamole.Layer.ATOP = 0x6;
/** /**
* Channel mask for the composite operation "xor". * Channel mask for the composite operation "xor".
*
* @type {!number}
*/ */
Guacamole.Layer.XOR = 0xA; Guacamole.Layer.XOR = 0xA;
/** /**
* Channel mask for the composite operation "rover". * Channel mask for the composite operation "rover".
*
* @type {!number}
*/ */
Guacamole.Layer.ROVER = 0xB; Guacamole.Layer.ROVER = 0xB;
/** /**
* Channel mask for the composite operation "over". * Channel mask for the composite operation "over".
*
* @type {!number}
*/ */
Guacamole.Layer.OVER = 0xE; Guacamole.Layer.OVER = 0xE;
/** /**
* Channel mask for the composite operation "plus". * Channel mask for the composite operation "plus".
*
* @type {!number}
*/ */
Guacamole.Layer.PLUS = 0xF; Guacamole.Layer.PLUS = 0xF;
@@ -907,6 +1052,8 @@ Guacamole.Layer.PLUS = 0xF;
* Beware that WebKit-based browsers may leave the contents of the destionation * Beware that WebKit-based browsers may leave the contents of the destionation
* layer where the source layer is transparent, despite the definition of this * layer where the source layer is transparent, despite the definition of this
* operation. * operation.
*
* @type {!number}
*/ */
Guacamole.Layer.RIN = 0x1; Guacamole.Layer.RIN = 0x1;
@@ -915,6 +1062,8 @@ Guacamole.Layer.RIN = 0x1;
* Beware that WebKit-based browsers may leave the contents of the destionation * Beware that WebKit-based browsers may leave the contents of the destionation
* layer where the source layer is transparent, despite the definition of this * layer where the source layer is transparent, despite the definition of this
* operation. * operation.
*
* @type {!number}
*/ */
Guacamole.Layer.IN = 0x4; Guacamole.Layer.IN = 0x4;
@@ -923,6 +1072,8 @@ Guacamole.Layer.IN = 0x4;
* Beware that WebKit-based browsers may leave the contents of the destionation * Beware that WebKit-based browsers may leave the contents of the destionation
* layer where the source layer is transparent, despite the definition of this * layer where the source layer is transparent, despite the definition of this
* operation. * operation.
*
* @type {!number}
*/ */
Guacamole.Layer.OUT = 0x8; Guacamole.Layer.OUT = 0x8;
@@ -931,6 +1082,8 @@ Guacamole.Layer.OUT = 0x8;
* Beware that WebKit-based browsers may leave the contents of the destionation * Beware that WebKit-based browsers may leave the contents of the destionation
* layer where the source layer is transparent, despite the definition of this * layer where the source layer is transparent, despite the definition of this
* operation. * operation.
*
* @type {!number}
*/ */
Guacamole.Layer.RATOP = 0x9; Guacamole.Layer.RATOP = 0x9;
@@ -939,6 +1092,8 @@ Guacamole.Layer.RATOP = 0x9;
* Beware that WebKit-based browsers may leave the contents of the destionation * Beware that WebKit-based browsers may leave the contents of the destionation
* layer where the source layer is transparent, despite the definition of this * layer where the source layer is transparent, despite the definition of this
* operation. * operation.
*
* @type {!number}
*/ */
Guacamole.Layer.SRC = 0xC; Guacamole.Layer.SRC = 0xC;
@@ -948,34 +1103,49 @@ Guacamole.Layer.SRC = 0xC;
* *
* @constructor * @constructor
* *
* @param {Number} r The red component of this pixel. * @param {!number} r
* @param {Number} g The green component of this pixel. * The red component of this pixel.
* @param {Number} b The blue component of this pixel. *
* @param {Number} a The alpha component of this pixel. * @param {!number} g
* The green component of this pixel.
*
* @param {!number} b
* The blue component of this pixel.
*
* @param {!number} a
* The alpha component of this pixel.
*/ */
Guacamole.Layer.Pixel = function(r, g, b, a) { Guacamole.Layer.Pixel = function(r, g, b, a) {
/** /**
* The red component of this pixel, where 0 is the minimum value, * The red component of this pixel, where 0 is the minimum value,
* and 255 is the maximum. * and 255 is the maximum.
*
* @type {!number}
*/ */
this.red = r; this.red = r;
/** /**
* The green component of this pixel, where 0 is the minimum value, * The green component of this pixel, where 0 is the minimum value,
* and 255 is the maximum. * and 255 is the maximum.
*
* @type {!number}
*/ */
this.green = g; this.green = g;
/** /**
* The blue component of this pixel, where 0 is the minimum value, * The blue component of this pixel, where 0 is the minimum value,
* and 255 is the maximum. * and 255 is the maximum.
*
* @type {!number}
*/ */
this.blue = b; this.blue = b;
/** /**
* The alpha component of this pixel, where 0 is the minimum value, * The alpha component of this pixel, where 0 is the minimum value,
* and 255 is the maximum. * and 255 is the maximum.
*
* @type {!number}
*/ */
this.alpha = a; this.alpha = a;

View File

@@ -41,7 +41,7 @@ var Guacamole = Guacamole || {};
* *
* @constructor * @constructor
* @augments Guacamole.Mouse.Event.Target * @augments Guacamole.Mouse.Event.Target
* @param {Element} element * @param {!Element} element
* The Element to use to provide mouse events. * The Element to use to provide mouse events.
*/ */
Guacamole.Mouse = function Mouse(element) { Guacamole.Mouse = function Mouse(element) {
@@ -50,29 +50,39 @@ Guacamole.Mouse = function Mouse(element) {
/** /**
* Reference to this Guacamole.Mouse. * Reference to this Guacamole.Mouse.
*
* @private * @private
* @type {!Guacamole.Mouse}
*/ */
var guac_mouse = this; var guac_mouse = this;
/** /**
* The number of mousemove events to require before re-enabling mouse * The number of mousemove events to require before re-enabling mouse
* event handling after receiving a touch event. * event handling after receiving a touch event.
*
* @type {!number}
*/ */
this.touchMouseThreshold = 3; this.touchMouseThreshold = 3;
/** /**
* The minimum amount of pixels scrolled required for a single scroll button * The minimum amount of pixels scrolled required for a single scroll button
* click. * click.
*
* @type {!number}
*/ */
this.scrollThreshold = 53; this.scrollThreshold = 53;
/** /**
* The number of pixels to scroll per line. * The number of pixels to scroll per line.
*
* @type {!number}
*/ */
this.PIXELS_PER_LINE = 18; this.PIXELS_PER_LINE = 18;
/** /**
* The number of pixels to scroll per page. * The number of pixels to scroll per page.
*
* @type {!number}
*/ */
this.PIXELS_PER_PAGE = this.PIXELS_PER_LINE * 16; this.PIXELS_PER_PAGE = this.PIXELS_PER_LINE * 16;
@@ -81,7 +91,7 @@ Guacamole.Mouse = function Mouse(element) {
* mouse button indices used by DOM mouse events. * mouse button indices used by DOM mouse events.
* *
* @private * @private
* @type {String[]} * @type {!string[]}
*/ */
var MOUSE_BUTTONS = [ var MOUSE_BUTTONS = [
Guacamole.Mouse.State.Buttons.LEFT, Guacamole.Mouse.State.Buttons.LEFT,
@@ -92,7 +102,9 @@ Guacamole.Mouse = function Mouse(element) {
/** /**
* Counter of mouse events to ignore. This decremented by mousemove, and * Counter of mouse events to ignore. This decremented by mousemove, and
* while non-zero, mouse events will have no effect. * while non-zero, mouse events will have no effect.
*
* @private * @private
* @type {!number}
*/ */
var ignore_mouse = 0; var ignore_mouse = 0;
@@ -102,6 +114,7 @@ Guacamole.Mouse = function Mouse(element) {
* threshold. * threshold.
* *
* @private * @private
* @type {!number}
*/ */
var scroll_delta = 0; var scroll_delta = 0;
@@ -254,7 +267,7 @@ Guacamole.Mouse = function Mouse(element) {
* coordinates. * coordinates.
* *
* @private * @private
* @type {Boolean} * @type {!boolean}
*/ */
var CSS3_CURSOR_SUPPORTED = (function() { var CSS3_CURSOR_SUPPORTED = (function() {
@@ -291,11 +304,18 @@ Guacamole.Mouse = function Mouse(element) {
* to do something else, such as use the software cursor built into * to do something else, such as use the software cursor built into
* Guacamole.Display, if the local cursor cannot be set. * Guacamole.Display, if the local cursor cannot be set.
* *
* @param {HTMLCanvasElement} canvas The cursor image. * @param {!HTMLCanvasElement} canvas
* @param {Number} x The X-coordinate of the cursor hotspot. * The cursor image.
* @param {Number} y The Y-coordinate of the cursor hotspot. *
* @return {!Boolean} true if the cursor was successfully set, false if the * @param {!number} x
* cursor could not be set for any reason. * The X-coordinate of the cursor hotspot.
*
* @param {!number} y
* The Y-coordinate of the cursor hotspot.
*
* @return {!boolean}
* true if the cursor was successfully set, false if the cursor could
* not be set for any reason.
*/ */
this.setCursor = function(canvas, x, y) { this.setCursor = function(canvas, x, y) {
@@ -318,7 +338,7 @@ Guacamole.Mouse = function Mouse(element) {
* *
* @constructor * @constructor
* @augments Guacamole.Position * @augments Guacamole.Position
* @param {Guacamole.Mouse.State|Object} [template={}] * @param {Guacamole.Mouse.State|object} [template={}]
* The object whose properties should be copied within the new * The object whose properties should be copied within the new
* Guacamole.Mouse.State. * Guacamole.Mouse.State.
*/ */
@@ -332,30 +352,30 @@ Guacamole.Mouse.State = function State(template) {
* Guacamole.Mouse.State constructor of Apache Guacamole 1.3.0 and older. * Guacamole.Mouse.State constructor of Apache Guacamole 1.3.0 and older.
* *
* @private * @private
* @param {Number} x * @param {!number} x
* The X position of the mouse pointer in pixels. * The X position of the mouse pointer in pixels.
* *
* @param {Number} y * @param {!number} y
* The Y position of the mouse pointer in pixels. * The Y position of the mouse pointer in pixels.
* *
* @param {Boolean} left * @param {!boolean} left
* Whether the left mouse button is pressed. * Whether the left mouse button is pressed.
* *
* @param {Boolean} middle * @param {!boolean} middle
* Whether the middle mouse button is pressed. * Whether the middle mouse button is pressed.
* *
* @param {Boolean} right * @param {!boolean} right
* Whether the right mouse button is pressed. * Whether the right mouse button is pressed.
* *
* @param {Boolean} up * @param {!boolean} up
* Whether the up mouse button is pressed (the fourth button, usually * Whether the up mouse button is pressed (the fourth button, usually
* part of a scroll wheel). * part of a scroll wheel).
* *
* @param {Boolean} down * @param {!boolean} down
* Whether the down mouse button is pressed (the fifth button, usually * Whether the down mouse button is pressed (the fifth button, usually
* part of a scroll wheel). * part of a scroll wheel).
* *
* @return {Object} * @return {!object}
* The equivalent template object that would be passed to the new * The equivalent template object that would be passed to the new
* Guacamole.Mouse.State constructor. * Guacamole.Mouse.State constructor.
*/ */
@@ -382,7 +402,7 @@ Guacamole.Mouse.State = function State(template) {
/** /**
* Whether the left mouse button is currently pressed. * Whether the left mouse button is currently pressed.
* *
* @type {Boolean} * @type {!boolean}
* @default false * @default false
*/ */
this.left = template.left || false; this.left = template.left || false;
@@ -390,7 +410,7 @@ Guacamole.Mouse.State = function State(template) {
/** /**
* Whether the middle mouse button is currently pressed. * Whether the middle mouse button is currently pressed.
* *
* @type {Boolean} * @type {!boolean}
* @default false * @default false
*/ */
this.middle = template.middle || false; this.middle = template.middle || false;
@@ -398,7 +418,7 @@ Guacamole.Mouse.State = function State(template) {
/** /**
* Whether the right mouse button is currently pressed. * Whether the right mouse button is currently pressed.
* *
* @type {Boolean} * @type {!boolean}
* @default false * @default false
*/ */
this.right = template.right || false; this.right = template.right || false;
@@ -408,7 +428,7 @@ Guacamole.Mouse.State = function State(template) {
* mouse button, associated with upward scrolling of the mouse scroll * mouse button, associated with upward scrolling of the mouse scroll
* wheel. * wheel.
* *
* @type {Boolean} * @type {!boolean}
* @default false * @default false
*/ */
this.up = template.up || false; this.up = template.up || false;
@@ -418,7 +438,7 @@ Guacamole.Mouse.State = function State(template) {
* mouse button, associated with downward scrolling of the mouse scroll * mouse button, associated with downward scrolling of the mouse scroll
* wheel. * wheel.
* *
* @type {Boolean} * @type {!boolean}
* @default false * @default false
*/ */
this.down = template.down || false; this.down = template.down || false;
@@ -439,7 +459,7 @@ Guacamole.Mouse.State.Buttons = {
* left mouse button. * left mouse button.
* *
* @constant * @constant
* @type {String} * @type {!string}
*/ */
LEFT : 'left', LEFT : 'left',
@@ -448,7 +468,7 @@ Guacamole.Mouse.State.Buttons = {
* middle mouse button. * middle mouse button.
* *
* @constant * @constant
* @type {String} * @type {!string}
*/ */
MIDDLE : 'middle', MIDDLE : 'middle',
@@ -457,7 +477,7 @@ Guacamole.Mouse.State.Buttons = {
* right mouse button. * right mouse button.
* *
* @constant * @constant
* @type {String} * @type {!string}
*/ */
RIGHT : 'right', RIGHT : 'right',
@@ -467,7 +487,7 @@ Guacamole.Mouse.State.Buttons = {
* wheel is scrolled up). * wheel is scrolled up).
* *
* @constant * @constant
* @type {String} * @type {!string}
*/ */
UP : 'up', UP : 'up',
@@ -477,7 +497,7 @@ Guacamole.Mouse.State.Buttons = {
* wheel is scrolled up). * wheel is scrolled up).
* *
* @constant * @constant
* @type {String} * @type {!string}
*/ */
DOWN : 'down' DOWN : 'down'
@@ -490,10 +510,10 @@ Guacamole.Mouse.State.Buttons = {
* *
* @constructor * @constructor
* @augments Guacamole.Event.DOMEvent * @augments Guacamole.Event.DOMEvent
* @param {String} type * @param {!string} type
* The type name of the event ("mousedown", "mouseup", etc.) * The type name of the event ("mousedown", "mouseup", etc.)
* *
* @param {Guacamole.Mouse.State} state * @param {!Guacamole.Mouse.State} state
* The current mouse state. * The current mouse state.
* *
* @param {Event|Event[]} [events=[]] * @param {Event|Event[]} [events=[]]
@@ -509,14 +529,14 @@ Guacamole.Mouse.Event = function MouseEvent(type, state, events) {
* *
* @private * @private
* @constant * @constant
* @type {String} * @type {!string}
*/ */
var legacyHandlerName = 'on' + this.type; var legacyHandlerName = 'on' + this.type;
/** /**
* The current mouse state at the time this event was fired. * The current mouse state at the time this event was fired.
* *
* @type {Guacamole.Mouse.State} * @type {!Guacamole.Mouse.State}
*/ */
this.state = state; this.state = state;
@@ -557,7 +577,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() {
* mouse events fire. This state object is also passed in as a parameter to * mouse events fire. This state object is also passed in as a parameter to
* the handler of any mouse events. * the handler of any mouse events.
* *
* @type {Guacamole.Mouse.State} * @type {!Guacamole.Mouse.State}
*/ */
this.currentState = new Guacamole.Mouse.State(); this.currentState = new Guacamole.Mouse.State();
@@ -572,7 +592,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() {
* [click()]{@link Guacamole.Mouse.Event.Target#click}. * [click()]{@link Guacamole.Mouse.Event.Target#click}.
* *
* @event Guacamole.Mouse.Event.Target#mousedown * @event Guacamole.Mouse.Event.Target#mousedown
* @param {Guacamole.Mouse.Event} event * @param {!Guacamole.Mouse.Event} event
* The mousedown event that was fired. * The mousedown event that was fired.
*/ */
@@ -587,7 +607,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() {
* [click()]{@link Guacamole.Mouse.Event.Target#click}. * [click()]{@link Guacamole.Mouse.Event.Target#click}.
* *
* @event Guacamole.Mouse.Event.Target#mouseup * @event Guacamole.Mouse.Event.Target#mouseup
* @param {Guacamole.Mouse.Event} event * @param {!Guacamole.Mouse.Event} event
* The mouseup event that was fired. * The mouseup event that was fired.
*/ */
@@ -601,7 +621,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() {
* or [move()]{@link Guacamole.Mouse.Event.Target#move}. * or [move()]{@link Guacamole.Mouse.Event.Target#move}.
* *
* @event Guacamole.Mouse.Event.Target#mousemove * @event Guacamole.Mouse.Event.Target#mousemove
* @param {Guacamole.Mouse.Event} event * @param {!Guacamole.Mouse.Event} event
* The mousemove event that was fired. * The mousemove event that was fired.
*/ */
@@ -614,7 +634,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() {
* or [out()]{@link Guacamole.Mouse.Event.Target#out}. * or [out()]{@link Guacamole.Mouse.Event.Target#out}.
* *
* @event Guacamole.Mouse.Event.Target#mouseout * @event Guacamole.Mouse.Event.Target#mouseout
* @param {Guacamole.Mouse.Event} event * @param {!Guacamole.Mouse.Event} event
* The mouseout event that was fired. * The mouseout event that was fired.
*/ */
@@ -626,7 +646,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() {
* *
* @fires Guacamole.Mouse.Event.Target#mousedown * @fires Guacamole.Mouse.Event.Target#mousedown
* *
* @param {String} button * @param {!string} button
* The name of the mouse button to press, as defined by * The name of the mouse button to press, as defined by
* {@link Guacamole.Mouse.State.Buttons}. * {@link Guacamole.Mouse.State.Buttons}.
* *
@@ -648,7 +668,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() {
* *
* @fires Guacamole.Mouse.Event.Target#mouseup * @fires Guacamole.Mouse.Event.Target#mouseup
* *
* @param {String} button * @param {!string} button
* The name of the mouse button to release, as defined by * The name of the mouse button to release, as defined by
* {@link Guacamole.Mouse.State.Buttons}. * {@link Guacamole.Mouse.State.Buttons}.
* *
@@ -671,7 +691,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() {
* @fires Guacamole.Mouse.Event.Target#mousedown * @fires Guacamole.Mouse.Event.Target#mousedown
* @fires Guacamole.Mouse.Event.Target#mouseup * @fires Guacamole.Mouse.Event.Target#mouseup
* *
* @param {String} button * @param {!string} button
* The name of the mouse button to click, as defined by * The name of the mouse button to click, as defined by
* {@link Guacamole.Mouse.State.Buttons}. * {@link Guacamole.Mouse.State.Buttons}.
* *
@@ -688,7 +708,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() {
* *
* @fires Guacamole.Mouse.Event.Target#mousemove * @fires Guacamole.Mouse.Event.Target#mousemove
* *
* @param {Guacamole.Position|Object} position * @param {!(Guacamole.Position|object)} position
* The new coordinates of the mouse pointer. This object may be a * The new coordinates of the mouse pointer. This object may be a
* {@link Guacamole.Position} or any object with "x" and "y" * {@link Guacamole.Position} or any object with "x" and "y"
* properties. * properties.
@@ -761,7 +781,7 @@ Guacamole.Mouse.Event.Target = function MouseEventTarget() {
* *
* @constructor * @constructor
* @augments Guacamole.Mouse.Event.Target * @augments Guacamole.Mouse.Event.Target
* @param {Element} element * @param {!Element} element
* The Element to use to provide touch events. * The Element to use to provide touch events.
*/ */
Guacamole.Mouse.Touchpad = function Touchpad(element) { Guacamole.Mouse.Touchpad = function Touchpad(element) {
@@ -777,25 +797,33 @@ Guacamole.Mouse.Touchpad = function Touchpad(element) {
/** /**
* Reference to this Guacamole.Mouse.Touchpad. * Reference to this Guacamole.Mouse.Touchpad.
*
* @private * @private
* @type {!Guacamole.Mouse.Touchpad}
*/ */
var guac_touchpad = this; var guac_touchpad = this;
/** /**
* The distance a two-finger touch must move per scrollwheel event, in * The distance a two-finger touch must move per scrollwheel event, in
* pixels. * pixels.
*
* @type {!number}
*/ */
this.scrollThreshold = 20 * (window.devicePixelRatio || 1); this.scrollThreshold = 20 * (window.devicePixelRatio || 1);
/** /**
* The maximum number of milliseconds to wait for a touch to end for the * The maximum number of milliseconds to wait for a touch to end for the
* gesture to be considered a click. * gesture to be considered a click.
*
* @type {!number}
*/ */
this.clickTimingThreshold = 250; this.clickTimingThreshold = 250;
/** /**
* The maximum number of pixels to allow a touch to move for the gesture to * The maximum number of pixels to allow a touch to move for the gesture to
* be considered a click. * be considered a click.
*
* @type {!number}
*/ */
this.clickMoveThreshold = 10 * (window.devicePixelRatio || 1); this.clickMoveThreshold = 10 * (window.devicePixelRatio || 1);
@@ -804,7 +832,7 @@ Guacamole.Mouse.Touchpad = function Touchpad(element) {
* mouse events fire. This state object is also passed in as a parameter to * mouse events fire. This state object is also passed in as a parameter to
* the handler of any mouse events. * the handler of any mouse events.
* *
* @type {Guacamole.Mouse.State} * @type {!Guacamole.Mouse.State}
*/ */
this.currentState = new Guacamole.Mouse.State(); this.currentState = new Guacamole.Mouse.State();
@@ -999,7 +1027,7 @@ Guacamole.Mouse.Touchpad = function Touchpad(element) {
* *
* @constructor * @constructor
* @augments Guacamole.Mouse.Event.Target * @augments Guacamole.Mouse.Event.Target
* @param {Element} element * @param {!Element} element
* The Element to use to provide touch events. * The Element to use to provide touch events.
*/ */
Guacamole.Mouse.Touchscreen = function Touchscreen(element) { Guacamole.Mouse.Touchscreen = function Touchscreen(element) {
@@ -1015,7 +1043,9 @@ Guacamole.Mouse.Touchscreen = function Touchscreen(element) {
/** /**
* Reference to this Guacamole.Mouse.Touchscreen. * Reference to this Guacamole.Mouse.Touchscreen.
*
* @private * @private
* @type {!Guacamole.Mouse.Touchscreen}
*/ */
var guac_touchscreen = this; var guac_touchscreen = this;
@@ -1024,18 +1054,23 @@ Guacamole.Mouse.Touchscreen = function Touchscreen(element) {
* will be ignored. * will be ignored.
* *
* @private * @private
* @type {!boolean}
*/ */
var gesture_in_progress = false; var gesture_in_progress = false;
/** /**
* The start X location of a gesture. * The start X location of a gesture.
*
* @private * @private
* @type {number}
*/ */
var gesture_start_x = null; var gesture_start_x = null;
/** /**
* The start Y location of a gesture. * The start Y location of a gesture.
*
* @private * @private
* @type {number}
*/ */
var gesture_start_y = null; var gesture_start_y = null;
@@ -1043,6 +1078,7 @@ Guacamole.Mouse.Touchscreen = function Touchscreen(element) {
* The timeout associated with the delayed, cancellable click release. * The timeout associated with the delayed, cancellable click release.
* *
* @private * @private
* @type {number}
*/ */
var click_release_timeout = null; var click_release_timeout = null;
@@ -1050,24 +1086,31 @@ Guacamole.Mouse.Touchscreen = function Touchscreen(element) {
* The timeout associated with long-press for right click. * The timeout associated with long-press for right click.
* *
* @private * @private
* @type {number}
*/ */
var long_press_timeout = null; var long_press_timeout = null;
/** /**
* The distance a two-finger touch must move per scrollwheel event, in * The distance a two-finger touch must move per scrollwheel event, in
* pixels. * pixels.
*
* @type {!number}
*/ */
this.scrollThreshold = 20 * (window.devicePixelRatio || 1); this.scrollThreshold = 20 * (window.devicePixelRatio || 1);
/** /**
* The maximum number of milliseconds to wait for a touch to end for the * The maximum number of milliseconds to wait for a touch to end for the
* gesture to be considered a click. * gesture to be considered a click.
*
* @type {!number}
*/ */
this.clickTimingThreshold = 250; this.clickTimingThreshold = 250;
/** /**
* The maximum number of pixels to allow a touch to move for the gesture to * The maximum number of pixels to allow a touch to move for the gesture to
* be considered a click. * be considered a click.
*
* @type {!number}
*/ */
this.clickMoveThreshold = 16 * (window.devicePixelRatio || 1); this.clickMoveThreshold = 16 * (window.devicePixelRatio || 1);
@@ -1082,9 +1125,11 @@ Guacamole.Mouse.Touchscreen = function Touchscreen(element) {
* clicking, based on where the touch gesture began. * clicking, based on where the touch gesture began.
* *
* @private * @private
* @param {TouchEvent} e The touch event to check. * @param {!TouchEvent} e
* @return {!Boolean} true if the movement threshold is exceeded, false * The touch event to check.
* otherwise. *
* @return {!boolean}
* true if the movement threshold is exceeded, false otherwise.
*/ */
function finger_moved(e) { function finger_moved(e) {
var touch = e.touches[0] || e.changedTouches[0]; var touch = e.touches[0] || e.changedTouches[0];
@@ -1098,7 +1143,8 @@ Guacamole.Mouse.Touchscreen = function Touchscreen(element) {
* touch event. * touch event.
* *
* @private * @private
* @param {TouchEvent} e The touch event beginning this new gesture. * @param {!TouchEvent} e
* The touch event beginning this new gesture.
*/ */
function begin_gesture(e) { function begin_gesture(e) {
var touch = e.touches[0]; var touch = e.touches[0];

View File

@@ -24,10 +24,10 @@ var Guacamole = Guacamole || {};
* input and output streams. * input and output streams.
* *
* @constructor * @constructor
* @param {Guacamole.Client} client * @param {!Guacamole.Client} client
* The client owning this object. * The client owning this object.
* *
* @param {Number} index * @param {!number} index
* The index of this object. * The index of this object.
*/ */
Guacamole.Object = function guacamoleObject(client, index) { Guacamole.Object = function guacamoleObject(client, index) {
@@ -36,7 +36,7 @@ Guacamole.Object = function guacamoleObject(client, index) {
* Reference to this Guacamole.Object. * Reference to this Guacamole.Object.
* *
* @private * @private
* @type {Guacamole.Object} * @type {!Guacamole.Object}
*/ */
var guacObject = this; var guacObject = this;
@@ -45,7 +45,7 @@ Guacamole.Object = function guacamoleObject(client, index) {
* callbacks is guaranteed to be in order of request. * callbacks is guaranteed to be in order of request.
* *
* @private * @private
* @type {Object.<String, Function[]>} * @type {!Object.<string, function[]>}
*/ */
var bodyCallbacks = {}; var bodyCallbacks = {};
@@ -55,10 +55,10 @@ Guacamole.Object = function guacamoleObject(client, index) {
* returned. * returned.
* *
* @private * @private
* @param {String} name * @param {!string} name
* The name of the stream to retrieve a callback for. * The name of the stream to retrieve a callback for.
* *
* @returns {Function} * @returns {function}
* The next callback associated with the stream having the given name, * The next callback associated with the stream having the given name,
* or null if no such callback exists. * or null if no such callback exists.
*/ */
@@ -84,10 +84,10 @@ Guacamole.Object = function guacamoleObject(client, index) {
* having the given name. * having the given name.
* *
* @private * @private
* @param {String} name * @param {!string} name
* The name of the stream to associate with the given callback. * The name of the stream to associate with the given callback.
* *
* @param {Function} callback * @param {!function} callback
* The callback to add to the queue of the stream with the given name. * The callback to add to the queue of the stream with the given name.
*/ */
var enqueueBodyCallback = function enqueueBodyCallback(name, callback) { var enqueueBodyCallback = function enqueueBodyCallback(name, callback) {
@@ -107,7 +107,7 @@ Guacamole.Object = function guacamoleObject(client, index) {
/** /**
* The index of this object. * The index of this object.
* *
* @type {Number} * @type {!number}
*/ */
this.index = index; this.index = index;
@@ -119,13 +119,13 @@ Guacamole.Object = function guacamoleObject(client, index) {
* handler here. * handler here.
* *
* @event * @event
* @param {Guacamole.InputStream} inputStream * @param {!Guacamole.InputStream} inputStream
* The input stream of the received body. * The input stream of the received body.
* *
* @param {String} mimetype * @param {!string} mimetype
* The mimetype of the data being received. * The mimetype of the data being received.
* *
* @param {String} name * @param {!string} name
* The name of the stream whose body has been received. * The name of the stream whose body has been received.
*/ */
this.onbody = function defaultBodyHandler(inputStream, mimetype, name) { this.onbody = function defaultBodyHandler(inputStream, mimetype, name) {
@@ -149,10 +149,10 @@ Guacamole.Object = function guacamoleObject(client, index) {
* Requests read access to the input stream having the given name. If * Requests read access to the input stream having the given name. If
* successful, a new input stream will be created. * successful, a new input stream will be created.
* *
* @param {String} name * @param {!string} name
* The name of the input stream to request. * The name of the input stream to request.
* *
* @param {Function} [bodyCallback] * @param {function} [bodyCallback]
* The callback to invoke when the body of the requested input stream * The callback to invoke when the body of the requested input stream
* is received. This callback will be provided a Guacamole.InputStream * is received. This callback will be provided a Guacamole.InputStream
* and its mimetype as its two only arguments. If the onbody handler of * and its mimetype as its two only arguments. If the onbody handler of
@@ -174,13 +174,13 @@ Guacamole.Object = function guacamoleObject(client, index) {
* given mimetype and name. The legality of a mimetype and name is dictated * given mimetype and name. The legality of a mimetype and name is dictated
* by the object itself. * by the object itself.
* *
* @param {String} mimetype * @param {!string} mimetype
* The mimetype of the data which will be sent to the output stream. * The mimetype of the data which will be sent to the output stream.
* *
* @param {String} name * @param {!string} name
* The defined name of an output stream within this object. * The defined name of an output stream within this object.
* *
* @returns {Guacamole.OutputStream} * @returns {!Guacamole.OutputStream}
* An output stream which will write blobs to the named output stream * An output stream which will write blobs to the named output stream
* of this object. * of this object.
*/ */
@@ -195,7 +195,7 @@ Guacamole.Object = function guacamoleObject(client, index) {
* the root stream MUST be a JSON map of stream name to mimetype. * the root stream MUST be a JSON map of stream name to mimetype.
* *
* @constant * @constant
* @type {String} * @type {!string}
*/ */
Guacamole.Object.ROOT_STREAM = '/'; Guacamole.Object.ROOT_STREAM = '/';
@@ -205,6 +205,6 @@ Guacamole.Object.ROOT_STREAM = '/';
* have this mimetype. * have this mimetype.
* *
* @constant * @constant
* @type {String} * @type {!string}
*/ */
Guacamole.Object.STREAM_INDEX_MIMETYPE = 'application/vnd.glyptodon.guacamole.stream-index+json'; Guacamole.Object.STREAM_INDEX_MIMETYPE = 'application/vnd.glyptodon.guacamole.stream-index+json';

View File

@@ -25,7 +25,7 @@ var Guacamole = Guacamole || {};
* own key events. * own key events.
* *
* @constructor * @constructor
* @param {Guacamole.OnScreenKeyboard.Layout} layout * @param {!Guacamole.OnScreenKeyboard.Layout} layout
* The layout of the on-screen keyboard to display. * The layout of the on-screen keyboard to display.
*/ */
Guacamole.OnScreenKeyboard = function(layout) { Guacamole.OnScreenKeyboard = function(layout) {
@@ -34,7 +34,7 @@ Guacamole.OnScreenKeyboard = function(layout) {
* Reference to this Guacamole.OnScreenKeyboard. * Reference to this Guacamole.OnScreenKeyboard.
* *
* @private * @private
* @type {Guacamole.OnScreenKeyboard} * @type {!Guacamole.OnScreenKeyboard}
*/ */
var osk = this; var osk = this;
@@ -44,7 +44,7 @@ Guacamole.OnScreenKeyboard = function(layout) {
* released. * released.
* *
* @private * @private
* @type {Object.<String, Number>} * @type {!Object.<String, Number>}
*/ */
var modifierKeysyms = {}; var modifierKeysyms = {};
@@ -54,7 +54,7 @@ Guacamole.OnScreenKeyboard = function(layout) {
* have a corresponding mapping to true. * have a corresponding mapping to true.
* *
* @private * @private
* @type {Object.<String, Boolean>} * @type {!Object.<String, Boolean>}
*/ */
var pressed = {}; var pressed = {};
@@ -65,7 +65,7 @@ Guacamole.OnScreenKeyboard = function(layout) {
* experience rounding error due to unit conversions. * experience rounding error due to unit conversions.
* *
* @private * @private
* @type {ScaledElement[]} * @type {!ScaledElement[]}
*/ */
var scaledElements = []; var scaledElements = [];
@@ -74,10 +74,10 @@ Guacamole.OnScreenKeyboard = function(layout) {
* *
* @private * @private
* @function * @function
* @param {Element} element * @param {!Element} element
* The element to add a class to. * The element to add a class to.
* *
* @param {String} classname * @param {!string} classname
* The name of the class to add. * The name of the class to add.
*/ */
var addClass = function addClass(element, classname) { var addClass = function addClass(element, classname) {
@@ -97,10 +97,10 @@ Guacamole.OnScreenKeyboard = function(layout) {
* *
* @private * @private
* @function * @function
* @param {Element} element * @param {!Element} element
* The element to remove a class from. * The element to remove a class from.
* *
* @param {String} classname * @param {!string} classname
* The name of the class to remove. * The name of the class to remove.
*/ */
var removeClass = function removeClass(element, classname) { var removeClass = function removeClass(element, classname) {
@@ -132,7 +132,7 @@ Guacamole.OnScreenKeyboard = function(layout) {
* while non-zero, mouse events will have no effect. * while non-zero, mouse events will have no effect.
* *
* @private * @private
* @type {Number} * @type {!number}
*/ */
var ignoreMouse = 0; var ignoreMouse = 0;
@@ -154,18 +154,18 @@ Guacamole.OnScreenKeyboard = function(layout) {
* *
* @private * @private
* @constructor * @constructor
* @param {Element} element * @param {!Element} element
* The element whose scale should be maintained. * The element whose scale should be maintained.
* *
* @param {Number} width * @param {!number} width
* The width of the element, in arbitrary units, relative to other * The width of the element, in arbitrary units, relative to other
* ScaledElements. * ScaledElements.
* *
* @param {Number} height * @param {!number} height
* The height of the element, in arbitrary units, relative to other * The height of the element, in arbitrary units, relative to other
* ScaledElements. * ScaledElements.
* *
* @param {Boolean} [scaleFont=false] * @param {boolean} [scaleFont=false]
* Whether the line height and font size should be scaled as well. * Whether the line height and font size should be scaled as well.
*/ */
var ScaledElement = function ScaledElement(element, width, height, scaleFont) { var ScaledElement = function ScaledElement(element, width, height, scaleFont) {
@@ -174,7 +174,7 @@ Guacamole.OnScreenKeyboard = function(layout) {
* The width of this ScaledElement, in arbitrary units, relative to * The width of this ScaledElement, in arbitrary units, relative to
* other ScaledElements. * other ScaledElements.
* *
* @type {Number} * @type {!number}
*/ */
this.width = width; this.width = width;
@@ -182,7 +182,7 @@ Guacamole.OnScreenKeyboard = function(layout) {
* The height of this ScaledElement, in arbitrary units, relative to * The height of this ScaledElement, in arbitrary units, relative to
* other ScaledElements. * other ScaledElements.
* *
* @type {Number} * @type {!number}
*/ */
this.height = height; this.height = height;
@@ -190,7 +190,7 @@ Guacamole.OnScreenKeyboard = function(layout) {
* Resizes the associated element, updating its dimensions according to * Resizes the associated element, updating its dimensions according to
* the given pixels per unit. * the given pixels per unit.
* *
* @param {Number} pixels * @param {!number} pixels
* The number of pixels to assign per arbitrary unit. * The number of pixels to assign per arbitrary unit.
*/ */
this.scale = function(pixels) { this.scale = function(pixels) {
@@ -214,10 +214,10 @@ Guacamole.OnScreenKeyboard = function(layout) {
* active. * active.
* *
* @private * @private
* @param {String[]} names * @param {!string[]} names
* The names of all modifiers to test. * The names of all modifiers to test.
* *
* @returns {boolean} * @returns {!boolean}
* true if all specified modifiers are pressed, false otherwise. * true if all specified modifiers are pressed, false otherwise.
*/ */
var modifiersPressed = function modifiersPressed(names) { var modifiersPressed = function modifiersPressed(names) {
@@ -243,7 +243,7 @@ Guacamole.OnScreenKeyboard = function(layout) {
* modifiers) are all currently satisfied. * modifiers) are all currently satisfied.
* *
* @private * @private
* @param {String} keyName * @param {!string} keyName
* The name of the key to retrieve. * The name of the key to retrieve.
* *
* @returns {Guacamole.OnScreenKeyboard.Key} * @returns {Guacamole.OnScreenKeyboard.Key}
@@ -281,10 +281,10 @@ Guacamole.OnScreenKeyboard = function(layout) {
* already pressed, this function has no effect. * already pressed, this function has no effect.
* *
* @private * @private
* @param {String} keyName * @param {!string} keyName
* The name of the key to press. * The name of the key to press.
* *
* @param {String} keyElement * @param {!string} keyElement
* The element associated with the given key. * The element associated with the given key.
*/ */
var press = function press(keyName, keyElement) { var press = function press(keyName, keyElement) {
@@ -349,10 +349,10 @@ Guacamole.OnScreenKeyboard = function(layout) {
* key is already released, this function has no effect. * key is already released, this function has no effect.
* *
* @private * @private
* @param {String} keyName * @param {!string} keyName
* The name of the key to release. * The name of the key to release.
* *
* @param {String} keyElement * @param {!string} keyElement
* The element associated with the given key. * The element associated with the given key.
*/ */
var release = function release(keyName, keyElement) { var release = function release(keyName, keyElement) {
@@ -399,7 +399,7 @@ Guacamole.OnScreenKeyboard = function(layout) {
* The number of mousemove events to require before re-enabling mouse * The number of mousemove events to require before re-enabling mouse
* event handling after receiving a touch event. * event handling after receiving a touch event.
* *
* @type {Number} * @type {!number}
*/ */
this.touchMouseThreshold = 3; this.touchMouseThreshold = 3;
@@ -407,7 +407,8 @@ Guacamole.OnScreenKeyboard = function(layout) {
* Fired whenever the user presses a key on this Guacamole.OnScreenKeyboard. * Fired whenever the user presses a key on this Guacamole.OnScreenKeyboard.
* *
* @event * @event
* @param {Number} keysym The keysym of the key being pressed. * @param {!number} keysym
* The keysym of the key being pressed.
*/ */
this.onkeydown = null; this.onkeydown = null;
@@ -415,20 +416,23 @@ Guacamole.OnScreenKeyboard = function(layout) {
* Fired whenever the user releases a key on this Guacamole.OnScreenKeyboard. * Fired whenever the user releases a key on this Guacamole.OnScreenKeyboard.
* *
* @event * @event
* @param {Number} keysym The keysym of the key being released. * @param {!number} keysym
* The keysym of the key being released.
*/ */
this.onkeyup = null; this.onkeyup = null;
/** /**
* The keyboard layout provided at time of construction. * The keyboard layout provided at time of construction.
* *
* @type {Guacamole.OnScreenKeyboard.Layout} * @type {!Guacamole.OnScreenKeyboard.Layout}
*/ */
this.layout = new Guacamole.OnScreenKeyboard.Layout(layout); this.layout = new Guacamole.OnScreenKeyboard.Layout(layout);
/** /**
* Returns the element containing the entire on-screen keyboard. * Returns the element containing the entire on-screen keyboard.
* @returns {!Element} The element containing the entire on-screen keyboard. *
* @returns {!Element}
* The element containing the entire on-screen keyboard.
*/ */
this.getElement = function() { this.getElement = function() {
return keyboard; return keyboard;
@@ -439,8 +443,8 @@ Guacamole.OnScreenKeyboard = function(layout) {
* the width is close to but does not exceed the specified width. The * the width is close to but does not exceed the specified width. The
* height of the keyboard is determined based on the width. * height of the keyboard is determined based on the width.
* *
* @param {Number} width The width to resize this Guacamole.OnScreenKeyboard * @param {!number} width
* to, in pixels. * The width to resize this Guacamole.OnScreenKeyboard to, in pixels.
*/ */
this.resize = function(width) { this.resize = function(width) {
@@ -462,10 +466,10 @@ Guacamole.OnScreenKeyboard = function(layout) {
* properties as needed, and ensuring the key name is defined. * properties as needed, and ensuring the key name is defined.
* *
* @private * @private
* @param {String} name * @param {!string} name
* The name of the key being coerced into an array of Key objects. * The name of the key being coerced into an array of Key objects.
* *
* @param {Number|String|Guacamole.OnScreenKeyboard.Key|Guacamole.OnScreenKeyboard.Key[]} object * @param {!(number|string|Guacamole.OnScreenKeyboard.Key|Guacamole.OnScreenKeyboard.Key[])} object
* The object defining the behavior of the key having the given name, * The object defining the behavior of the key having the given name,
* which may be the title of the key (a string), the keysym (a number), * which may be the title of the key (a string), the keysym (a number),
* a single Key object, or an array of Key objects. * a single Key object, or an array of Key objects.
@@ -512,12 +516,12 @@ Guacamole.OnScreenKeyboard = function(layout) {
* objects. * objects.
* *
* @private * @private
* @param {Object.<String, Number|String|Guacamole.OnScreenKeyboard.Key|Guacamole.OnScreenKeyboard.Key[]>} keys * @param {!Object.<string, number|string|Guacamole.OnScreenKeyboard.Key|Guacamole.OnScreenKeyboard.Key[]>} keys
* A mapping of key name to key definition, where the key definition is * A mapping of key name to key definition, where the key definition is
* the title of the key (a string), the keysym (a number), a single * the title of the key (a string), the keysym (a number), a single
* Key object, or an array of Key objects. * Key object, or an array of Key objects.
* *
* @returns {Object.<String, Guacamole.OnScreenKeyboard.Key[]>} * @returns {!Object.<string, Guacamole.OnScreenKeyboard.Key[]>}
* A more-predictable mapping of key name to key definition, where the * A more-predictable mapping of key name to key definition, where the
* key definition is always simply an array of Key objects. * key definition is always simply an array of Key objects.
*/ */
@@ -538,7 +542,7 @@ Guacamole.OnScreenKeyboard = function(layout) {
* Map of all key names to their corresponding set of keys. Each key name * Map of all key names to their corresponding set of keys. Each key name
* may correspond to multiple keys due to the effect of modifiers. * may correspond to multiple keys due to the effect of modifiers.
* *
* @type {Object.<String, Guacamole.OnScreenKeyboard.Key[]>} * @type {!Object.<string, Guacamole.OnScreenKeyboard.Key[]>}
*/ */
this.keys = getKeys(layout.keys); this.keys = getKeys(layout.keys);
@@ -550,11 +554,11 @@ Guacamole.OnScreenKeyboard = function(layout) {
* contiguous non-alphanumeric characters. * contiguous non-alphanumeric characters.
* *
* @private * @private
* @param {String} name * @param {!string} name
* An arbitrary string representing the name of some component of the * An arbitrary string representing the name of some component of the
* on-screen keyboard. * on-screen keyboard.
* *
* @returns {string} * @returns {!string}
* A string formatted for use as a CSS class name. * A string formatted for use as a CSS class name.
*/ */
var getCSSName = function getCSSName(name) { var getCSSName = function getCSSName(name) {
@@ -598,14 +602,14 @@ Guacamole.OnScreenKeyboard = function(layout) {
* will be scaled according to the same size units as each key. * will be scaled according to the same size units as each key.
* *
* @private * @private
* @param {Element} element * @param {!Element} element
* The element to append elements to. * The element to append elements to.
* *
* @param {Array|Object|String|Number} object * @param {!(Array|object|string|number)} object
* The layout structure object to use when constructing the elements to * The layout structure object to use when constructing the elements to
* append. * append.
* *
* @param {String} [name] * @param {string} [name]
* The name of the top-level element being appended, if any. * The name of the top-level element being appended, if any.
*/ */
var appendElements = function appendElements(element, object, name) { var appendElements = function appendElements(element, object, name) {
@@ -709,7 +713,7 @@ Guacamole.OnScreenKeyboard = function(layout) {
* touchMouseThreshold events. * touchMouseThreshold events.
* *
* @private * @private
* @param {TouchEvent} e * @param {!TouchEvent} e
* The touch event being handled. * The touch event being handled.
*/ */
var touchPress = function touchPress(e) { var touchPress = function touchPress(e) {
@@ -724,7 +728,7 @@ Guacamole.OnScreenKeyboard = function(layout) {
* touchMouseThreshold events. * touchMouseThreshold events.
* *
* @private * @private
* @param {TouchEvent} e * @param {!TouchEvent} e
* The touch event being handled. * The touch event being handled.
*/ */
var touchRelease = function touchRelease(e) { var touchRelease = function touchRelease(e) {
@@ -739,7 +743,7 @@ Guacamole.OnScreenKeyboard = function(layout) {
* does nothing. * does nothing.
* *
* @private * @private
* @param {MouseEvent} e * @param {!MouseEvent} e
* The touch event being handled. * The touch event being handled.
*/ */
var mousePress = function mousePress(e) { var mousePress = function mousePress(e) {
@@ -754,7 +758,7 @@ Guacamole.OnScreenKeyboard = function(layout) {
* does nothing. * does nothing.
* *
* @private * @private
* @param {MouseEvent} e * @param {!MouseEvent} e
* The touch event being handled. * The touch event being handled.
*/ */
var mouseRelease = function mouseRelease(e) { var mouseRelease = function mouseRelease(e) {
@@ -789,7 +793,7 @@ Guacamole.OnScreenKeyboard = function(layout) {
* keys, their behaviors, and their relative position and sizing. * keys, their behaviors, and their relative position and sizing.
* *
* @constructor * @constructor
* @param {Guacamole.OnScreenKeyboard.Layout|Object} template * @param {!(Guacamole.OnScreenKeyboard.Layout|object)} template
* The object whose identically-named properties will be used to initialize * The object whose identically-named properties will be used to initialize
* the properties of this layout. * the properties of this layout.
*/ */
@@ -800,7 +804,7 @@ Guacamole.OnScreenKeyboard.Layout = function(template) {
* informational purposes only, but it is recommend to conform to the * informational purposes only, but it is recommend to conform to the
* [language code]_[country code] format. * [language code]_[country code] format.
* *
* @type {String} * @type {!string}
*/ */
this.language = template.language; this.language = template.language;
@@ -808,7 +812,7 @@ Guacamole.OnScreenKeyboard.Layout = function(template) {
* The type of keyboard layout, such as "qwerty". This property is for * The type of keyboard layout, such as "qwerty". This property is for
* informational purposes only, and does not conform to any standard. * informational purposes only, and does not conform to any standard.
* *
* @type {String} * @type {!string}
*/ */
this.type = template.type; this.type = template.type;
@@ -818,7 +822,7 @@ Guacamole.OnScreenKeyboard.Layout = function(template) {
* implicitly. In all cases, the name property of the key object will be * implicitly. In all cases, the name property of the key object will be
* taken from the name given in the mapping. * taken from the name given in the mapping.
* *
* @type {Object.<String, Number|String|Guacamole.OnScreenKeyboard.Key|Guacamole.OnScreenKeyboard.Key[]>} * @type {!Object.<string, number|string|Guacamole.OnScreenKeyboard.Key|Guacamole.OnScreenKeyboard.Key[]>}
*/ */
this.keys = template.keys; this.keys = template.keys;
@@ -831,7 +835,7 @@ Guacamole.OnScreenKeyboard.Layout = function(template) {
* numbers present will be transformed into gaps of that size, scaled * numbers present will be transformed into gaps of that size, scaled
* according to the same units as each key. * according to the same units as each key.
* *
* @type {Object} * @type {!object}
*/ */
this.layout = template.layout; this.layout = template.layout;
@@ -841,7 +845,7 @@ Guacamole.OnScreenKeyboard.Layout = function(template) {
* the same units. The conversion factor between these units and pixels is * the same units. The conversion factor between these units and pixels is
* derived later via a call to resize() on the Guacamole.OnScreenKeyboard. * derived later via a call to resize() on the Guacamole.OnScreenKeyboard.
* *
* @type {Number} * @type {!number}
*/ */
this.width = template.width; this.width = template.width;
@@ -851,7 +855,7 @@ Guacamole.OnScreenKeyboard.Layout = function(template) {
* overall size of the keyboard. If not defined here, the width of each * overall size of the keyboard. If not defined here, the width of each
* key will default to 1. * key will default to 1.
* *
* @type {Object.<String, Number>} * @type {!Object.<string, number>}
*/ */
this.keyWidths = template.keyWidths || {}; this.keyWidths = template.keyWidths || {};
@@ -865,11 +869,11 @@ Guacamole.OnScreenKeyboard.Layout = function(template) {
* depends on modifier states. * depends on modifier states.
* *
* @constructor * @constructor
* @param {Guacamole.OnScreenKeyboard.Key|Object} template * @param {!(Guacamole.OnScreenKeyboard.Key|object)} template
* The object whose identically-named properties will be used to initialize * The object whose identically-named properties will be used to initialize
* the properties of this key. * the properties of this key.
* *
* @param {String} [name] * @param {string} [name]
* The name to use instead of any name provided within the template, if * The name to use instead of any name provided within the template, if
* any. If omitted, the name within the template will be used, assuming the * any. If omitted, the name within the template will be used, assuming the
* template contains a name. * template contains a name.
@@ -879,7 +883,7 @@ Guacamole.OnScreenKeyboard.Key = function(template, name) {
/** /**
* The unique name identifying this key within the keyboard layout. * The unique name identifying this key within the keyboard layout.
* *
* @type {String} * @type {!string}
*/ */
this.name = name || template.name; this.name = name || template.name;
@@ -887,7 +891,7 @@ Guacamole.OnScreenKeyboard.Key = function(template, name) {
* The human-readable title that will be displayed to the user within the * The human-readable title that will be displayed to the user within the
* key. If not provided, this will be derived from the key name. * key. If not provided, this will be derived from the key name.
* *
* @type {String} * @type {!string}
*/ */
this.title = template.title || this.name; this.title = template.title || this.name;
@@ -896,7 +900,7 @@ Guacamole.OnScreenKeyboard.Key = function(template, name) {
* not provided, this will be derived from the title if the title is a * not provided, this will be derived from the title if the title is a
* single character. * single character.
* *
* @type {Number} * @type {number}
*/ */
this.keysym = template.keysym || (function deriveKeysym(title) { this.keysym = template.keysym || (function deriveKeysym(title) {
@@ -925,7 +929,7 @@ Guacamole.OnScreenKeyboard.Key = function(template, name) {
* the "shift" modifier, for example. By default, the key will affect no * the "shift" modifier, for example. By default, the key will affect no
* modifiers. * modifiers.
* *
* @type {String} * @type {string}
*/ */
this.modifier = template.modifier; this.modifier = template.modifier;
@@ -936,7 +940,7 @@ Guacamole.OnScreenKeyboard.Key = function(template, name) {
* is named "shift" within the layout. By default, the key will require * is named "shift" within the layout. By default, the key will require
* no modifiers. * no modifiers.
* *
* @type {String[]} * @type {!string[]}
*/ */
this.requires = template.requires || []; this.requires = template.requires || [];

View File

@@ -23,20 +23,25 @@ var Guacamole = Guacamole || {};
* Abstract stream which can receive data. * Abstract stream which can receive data.
* *
* @constructor * @constructor
* @param {Guacamole.Client} client The client owning this stream. * @param {!Guacamole.Client} client
* @param {Number} index The index of this stream. * The client owning this stream.
*
* @param {!number} index
* The index of this stream.
*/ */
Guacamole.OutputStream = function(client, index) { Guacamole.OutputStream = function(client, index) {
/** /**
* Reference to this stream. * Reference to this stream.
*
* @private * @private
* @type {!Guacamole.OutputStream}
*/ */
var guac_stream = this; var guac_stream = this;
/** /**
* The index of this stream. * The index of this stream.
* @type {Number} * @type {!number}
*/ */
this.index = index; this.index = index;
@@ -45,14 +50,16 @@ Guacamole.OutputStream = function(client, index) {
* that a stream operation has completed, or an error has occurred. * that a stream operation has completed, or an error has occurred.
* *
* @event * @event
* @param {Guacamole.Status} status The status of the operation. * @param {!Guacamole.Status} status
* The status of the operation.
*/ */
this.onack = null; this.onack = null;
/** /**
* Writes the given base64-encoded data to this stream as a blob. * Writes the given base64-encoded data to this stream as a blob.
* *
* @param {String} data The base64-encoded data to send. * @param {!string} data
* The base64-encoded data to send.
*/ */
this.sendBlob = function(data) { this.sendBlob = function(data) {
client.sendBlob(guac_stream.index, data); client.sendBlob(guac_stream.index, data);

View File

@@ -61,7 +61,8 @@ Guacamole.Parser = function() {
* this Guacamole.Parser, executing all completed instructions at * this Guacamole.Parser, executing all completed instructions at
* the beginning of this buffer, if any. * the beginning of this buffer, if any.
* *
* @param {String} packet The instruction data to receive. * @param {!string} packet
* The instruction data to receive.
*/ */
this.receive = function(packet) { this.receive = function(packet) {
@@ -147,9 +148,11 @@ Guacamole.Parser = function() {
* Fired once for every complete Guacamole instruction received, in order. * Fired once for every complete Guacamole instruction received, in order.
* *
* @event * @event
* @param {String} opcode The Guacamole instruction opcode. * @param {!string} opcode
* @param {Array} parameters The parameters provided for the instruction, * The Guacamole instruction opcode.
* if any. *
* @param {!string[]} parameters
* The parameters provided for the instruction, if any.
*/ */
this.oninstruction = null; this.oninstruction = null;

View File

@@ -23,7 +23,7 @@ var Guacamole = Guacamole || {};
* A position in 2-D space. * A position in 2-D space.
* *
* @constructor * @constructor
* @param {Guacamole.Position|Object} [template={}] * @param {Guacamole.Position|object} [template={}]
* The object whose properties should be copied within the new * The object whose properties should be copied within the new
* Guacamole.Position. * Guacamole.Position.
*/ */
@@ -34,7 +34,7 @@ Guacamole.Position = function Position(template) {
/** /**
* The current X position, in pixels. * The current X position, in pixels.
* *
* @type {Number} * @type {!number}
* @default 0 * @default 0
*/ */
this.x = template.x || 0; this.x = template.x || 0;
@@ -42,7 +42,7 @@ Guacamole.Position = function Position(template) {
/** /**
* The current Y position, in pixels. * The current Y position, in pixels.
* *
* @type {Number} * @type {!number}
* @default 0 * @default 0
*/ */
this.y = template.y || 0; this.y = template.y || 0;
@@ -54,13 +54,13 @@ Guacamole.Position = function Position(template) {
* JavaScript event objects. The final position is translated to * JavaScript event objects. The final position is translated to
* coordinates that are relative the given element. * coordinates that are relative the given element.
* *
* @param {Element} element * @param {!Element} element
* The element the coordinates should be relative to. * The element the coordinates should be relative to.
* *
* @param {Number} clientX * @param {!number} clientX
* The viewport-relative X coordinate to translate. * The viewport-relative X coordinate to translate.
* *
* @param {Number} clientY * @param {!number} clientY
* The viewport-relative Y coordinate to translate. * The viewport-relative Y coordinate to translate.
*/ */
this.fromClientPosition = function fromClientPosition(element, clientX, clientY) { this.fromClientPosition = function fromClientPosition(element, clientX, clientY) {
@@ -98,16 +98,16 @@ Guacamole.Position = function Position(template) {
* commonly available within JavaScript event objects. The final position is * commonly available within JavaScript event objects. The final position is
* translated to coordinates that are relative the given element. * translated to coordinates that are relative the given element.
* *
* @param {Element} element * @param {!Element} element
* The element the coordinates should be relative to. * The element the coordinates should be relative to.
* *
* @param {Number} clientX * @param {!number} clientX
* The viewport-relative X coordinate to translate. * The viewport-relative X coordinate to translate.
* *
* @param {Number} clientY * @param {!number} clientY
* The viewport-relative Y coordinate to translate. * The viewport-relative Y coordinate to translate.
* *
* @returns {Guacamole.Position} * @returns {!Guacamole.Position}
* A new Guacamole.Position representing the relative position of the given * A new Guacamole.Position representing the relative position of the given
* client coordinates. * client coordinates.
*/ */

View File

@@ -26,7 +26,7 @@ var Guacamole = Guacamole || {};
* overall sample rate. * overall sample rate.
* *
* @constructor * @constructor
* @param {Guacamole.RawAudioFormat|Object} template * @param {!(Guacamole.RawAudioFormat|object)} template
* The object whose properties should be copied into the corresponding * The object whose properties should be copied into the corresponding
* properties of the new Guacamole.RawAudioFormat. * properties of the new Guacamole.RawAudioFormat.
*/ */
@@ -36,21 +36,21 @@ Guacamole.RawAudioFormat = function RawAudioFormat(template) {
* The number of bytes in each sample of audio data. This value is * The number of bytes in each sample of audio data. This value is
* independent of the number of channels. * independent of the number of channels.
* *
* @type {Number} * @type {!number}
*/ */
this.bytesPerSample = template.bytesPerSample; this.bytesPerSample = template.bytesPerSample;
/** /**
* The number of audio channels (ie: 1 for mono, 2 for stereo). * The number of audio channels (ie: 1 for mono, 2 for stereo).
* *
* @type {Number} * @type {!number}
*/ */
this.channels = template.channels; this.channels = template.channels;
/** /**
* The number of samples per second, per channel. * The number of samples per second, per channel.
* *
* @type {Number} * @type {!number}
*/ */
this.rate = template.rate; this.rate = template.rate;
@@ -61,7 +61,7 @@ Guacamole.RawAudioFormat = function RawAudioFormat(template) {
* which describes the type of raw audio data represented by that mimetype. If * which describes the type of raw audio data represented by that mimetype. If
* the mimetype is not a supported raw audio data mimetype, null is returned. * the mimetype is not a supported raw audio data mimetype, null is returned.
* *
* @param {String} mimetype * @param {!string} mimetype
* The audio mimetype to parse. * The audio mimetype to parse.
* *
* @returns {Guacamole.RawAudioFormat} * @returns {Guacamole.RawAudioFormat}

View File

@@ -27,7 +27,7 @@ var Guacamole = Guacamole || {};
* while the recording has not yet finished being created or downloaded. * while the recording has not yet finished being created or downloaded.
* *
* @constructor * @constructor
* @param {Guacamole.Tunnel} tunnel * @param {!Guacamole.Tunnel} tunnel
* The Guacamole.Tunnel from which the instructions of the recording should * The Guacamole.Tunnel from which the instructions of the recording should
* be read. * be read.
*/ */
@@ -37,7 +37,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* Reference to this Guacamole.SessionRecording. * Reference to this Guacamole.SessionRecording.
* *
* @private * @private
* @type {Guacamole.SessionRecording} * @type {!Guacamole.SessionRecording}
*/ */
var recording = this; var recording = this;
@@ -47,7 +47,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* *
* @private * @private
* @constant * @constant
* @type {Number} * @type {!number}
*/ */
var KEYFRAME_CHAR_INTERVAL = 16384; var KEYFRAME_CHAR_INTERVAL = 16384;
@@ -56,7 +56,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* *
* @private * @private
* @constant * @constant
* @type {Number} * @type {!number}
*/ */
var KEYFRAME_TIME_INTERVAL = 5000; var KEYFRAME_TIME_INTERVAL = 5000;
@@ -67,7 +67,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* *
* @private * @private
* @constant * @constant
* @type {Number} * @type {!number}
*/ */
var MAXIMUM_SEEK_TIME = 5; var MAXIMUM_SEEK_TIME = 5;
@@ -75,7 +75,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* All frames parsed from the provided tunnel. * All frames parsed from the provided tunnel.
* *
* @private * @private
* @type {Guacamole.SessionRecording._Frame[]} * @type {!Guacamole.SessionRecording._Frame[]}
*/ */
var frames = []; var frames = [];
@@ -84,7 +84,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* the frames array. * the frames array.
* *
* @private * @private
* @type {Guacamole.SessionRecording._Frame.Instruction[]} * @type {!Guacamole.SessionRecording._Frame.Instruction[]}
*/ */
var instructions = []; var instructions = [];
@@ -93,7 +93,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* provided tunnel since the last frame was flagged for use as a keyframe. * provided tunnel since the last frame was flagged for use as a keyframe.
* *
* @private * @private
* @type {Number} * @type {!number}
*/ */
var charactersSinceLastKeyframe = 0; var charactersSinceLastKeyframe = 0;
@@ -102,7 +102,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* If no timestamp has yet been flagged, this will be 0. * If no timestamp has yet been flagged, this will be 0.
* *
* @private * @private
* @type {Number} * @type {!number}
*/ */
var lastKeyframeTimestamp = 0; var lastKeyframeTimestamp = 0;
@@ -111,7 +111,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* Guacamole.SessionRecording for playback of the session recording. * Guacamole.SessionRecording for playback of the session recording.
* *
* @private * @private
* @type {Guacamole.SessionRecording._PlaybackTunnel} * @type {!Guacamole.SessionRecording._PlaybackTunnel}
*/ */
var playbackTunnel = new Guacamole.SessionRecording._PlaybackTunnel(); var playbackTunnel = new Guacamole.SessionRecording._PlaybackTunnel();
@@ -120,7 +120,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* recording. * recording.
* *
* @private * @private
* @type {Guacamole.Client} * @type {!Guacamole.Client}
*/ */
var playbackClient = new Guacamole.Client(playbackTunnel); var playbackClient = new Guacamole.Client(playbackTunnel);
@@ -129,7 +129,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* yet rendered, this will be -1. * yet rendered, this will be -1.
* *
* @private * @private
* @type {Number} * @type {!number}
*/ */
var currentFrame = -1; var currentFrame = -1;
@@ -138,7 +138,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* playback is not in progress, this will be null. * playback is not in progress, this will be null.
* *
* @private * @private
* @type {Number} * @type {number}
*/ */
var startVideoTimestamp = null; var startVideoTimestamp = null;
@@ -147,7 +147,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* playback is not in progress, this will be null. * playback is not in progress, this will be null.
* *
* @private * @private
* @type {Number} * @type {number}
*/ */
var startRealTimestamp = null; var startRealTimestamp = null;
@@ -157,7 +157,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* any) will not be valid. * any) will not be valid.
* *
* @private * @private
* @type {Number} * @type {number}
*/ */
var seekTimeout = null; var seekTimeout = null;
@@ -212,10 +212,10 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* to the first frame in the recording. * to the first frame in the recording.
* *
* @private * @private
* @param {Number} timestamp * @param {!number} timestamp
* The timestamp to convert to a relative timestamp. * The timestamp to convert to a relative timestamp.
* *
* @returns {number} * @returns {!number}
* The difference in milliseconds between the given timestamp and the * The difference in milliseconds between the given timestamp and the
* first frame of the recording, or zero if no frames yet exist. * first frame of the recording, or zero if no frames yet exist.
*/ */
@@ -235,19 +235,19 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* relative timestamp closest to the timestamp given. * relative timestamp closest to the timestamp given.
* *
* @private * @private
* @param {Number} minIndex * @param {!number} minIndex
* The index of the first frame in the region (the frame having the * The index of the first frame in the region (the frame having the
* smallest timestamp). * smallest timestamp).
* *
* @param {Number} maxIndex * @param {!number} maxIndex
* The index of the last frame in the region (the frame having the * The index of the last frame in the region (the frame having the
* largest timestamp). * largest timestamp).
* *
* @param {Number} timestamp * @param {!number} timestamp
* The relative timestamp to search for, where zero denotes the first * The relative timestamp to search for, where zero denotes the first
* frame in the recording. * frame in the recording.
* *
* @returns {Number} * @returns {!number}
* The index of the frame having a relative timestamp closest to the * The index of the frame having a relative timestamp closest to the
* given value. * given value.
*/ */
@@ -280,7 +280,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* instructions to the playback client. * instructions to the playback client.
* *
* @private * @private
* @param {Number} index * @param {!number} index
* The index of the frame within the frames array which should be * The index of the frame within the frames array which should be
* replayed. * replayed.
*/ */
@@ -311,14 +311,14 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* can be observed through the onseek handler and the provided callback. * can be observed through the onseek handler and the provided callback.
* *
* @private * @private
* @param {Number} index * @param {!number} index
* The index of the frame which should become the new playback * The index of the frame which should become the new playback
* position. * position.
* *
* @param {function} callback * @param {!function} callback
* The callback to invoke once the seek operation has completed. * The callback to invoke once the seek operation has completed.
* *
* @param {Number} [delay=0] * @param {number} [delay=0]
* The number of milliseconds that the seek operation should be * The number of milliseconds that the seek operation should be
* scheduled to take. * scheduled to take.
*/ */
@@ -438,7 +438,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* being downloaded. * being downloaded.
* *
* @event * @event
* @param {Number} duration * @param {!number} duration
* The new duration of the recording, in milliseconds. * The new duration of the recording, in milliseconds.
*/ */
this.onprogress = null; this.onprogress = null;
@@ -464,7 +464,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* Fired whenever the playback position within the recording changes. * Fired whenever the playback position within the recording changes.
* *
* @event * @event
* @param {Number} position * @param {!number} position
* The new position within the recording, in milliseconds. * The new position within the recording, in milliseconds.
*/ */
this.onseek = null; this.onseek = null;
@@ -474,7 +474,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* session. Playback of the Guacamole session cannot occur until at least * session. Playback of the Guacamole session cannot occur until at least
* one frame worth of instructions has been downloaded. * one frame worth of instructions has been downloaded.
* *
* @param {String} data * @param {string} [data]
* The data to send to the tunnel when connecting. * The data to send to the tunnel when connecting.
*/ */
this.connect = function connect(data) { this.connect = function connect(data) {
@@ -495,7 +495,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* which can be added to the DOM, causing the display (and thus playback of * which can be added to the DOM, causing the display (and thus playback of
* the recording) to become visible. * the recording) to become visible.
* *
* @return {Guacamole.Display} * @return {!Guacamole.Display}
* The underlying display of the Guacamole.Client used by this * The underlying display of the Guacamole.Client used by this
* Guacamole.SessionRecording for playback. * Guacamole.SessionRecording for playback.
*/ */
@@ -506,7 +506,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
/** /**
* Returns whether playback is currently in progress. * Returns whether playback is currently in progress.
* *
* @returns {boolean} * @returns {!boolean}
* true if playback is currently in progress, false otherwise. * true if playback is currently in progress, false otherwise.
*/ */
this.isPlaying = function isPlaying() { this.isPlaying = function isPlaying() {
@@ -517,7 +517,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* Returns the current playback position within the recording, in * Returns the current playback position within the recording, in
* milliseconds, where zero is the start of the recording. * milliseconds, where zero is the start of the recording.
* *
* @returns {Number} * @returns {!number}
* The current playback position within the recording, in milliseconds. * The current playback position within the recording, in milliseconds.
*/ */
this.getPosition = function getPosition() { this.getPosition = function getPosition() {
@@ -536,7 +536,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* Returns the duration of this recording, in milliseconds. If the * Returns the duration of this recording, in milliseconds. If the
* recording is still being downloaded, this value will gradually increase. * recording is still being downloaded, this value will gradually increase.
* *
* @returns {Number} * @returns {!number}
* The duration of this recording, in milliseconds. * The duration of this recording, in milliseconds.
*/ */
this.getDuration = function getDuration() { this.getDuration = function getDuration() {
@@ -591,7 +591,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* progress, that seek is first aborted. The seek operation will proceed * progress, that seek is first aborted. The seek operation will proceed
* asynchronously. * asynchronously.
* *
* @param {Number} position * @param {!number} position
* The position within the recording to seek to, in milliseconds. * The position within the recording to seek to, in milliseconds.
* *
* @param {function} [callback] * @param {function} [callback]
@@ -660,11 +660,11 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* *
* @private * @private
* @constructor * @constructor
* @param {Number} timestamp * @param {!number} timestamp
* The timestamp of this frame, as dictated by the "sync" instruction which * The timestamp of this frame, as dictated by the "sync" instruction which
* terminates the frame. * terminates the frame.
* *
* @param {Guacamole.SessionRecording._Frame.Instruction[]} instructions * @param {!Guacamole.SessionRecording._Frame.Instruction[]} instructions
* All instructions which are necessary to generate this frame relative to * All instructions which are necessary to generate this frame relative to
* the previous frame in the Guacamole session. * the previous frame in the Guacamole session.
*/ */
@@ -676,7 +676,7 @@ Guacamole.SessionRecording._Frame = function _Frame(timestamp, instructions) {
* set for the frame to be used as a keyframe. By default, frames are not * set for the frame to be used as a keyframe. By default, frames are not
* keyframes. * keyframes.
* *
* @type {Boolean} * @type {!boolean}
* @default false * @default false
*/ */
this.keyframe = false; this.keyframe = false;
@@ -685,7 +685,7 @@ Guacamole.SessionRecording._Frame = function _Frame(timestamp, instructions) {
* The timestamp of this frame, as dictated by the "sync" instruction which * The timestamp of this frame, as dictated by the "sync" instruction which
* terminates the frame. * terminates the frame.
* *
* @type {Number} * @type {!number}
*/ */
this.timestamp = timestamp; this.timestamp = timestamp;
@@ -693,7 +693,7 @@ Guacamole.SessionRecording._Frame = function _Frame(timestamp, instructions) {
* All instructions which are necessary to generate this frame relative to * All instructions which are necessary to generate this frame relative to
* the previous frame in the Guacamole session. * the previous frame in the Guacamole session.
* *
* @type {Guacamole.SessionRecording._Frame.Instruction[]} * @type {!Guacamole.SessionRecording._Frame.Instruction[]}
*/ */
this.instructions = instructions; this.instructions = instructions;
@@ -702,7 +702,7 @@ Guacamole.SessionRecording._Frame = function _Frame(timestamp, instructions) {
* a call to exportState(). If no such snapshot has been taken, this will * a call to exportState(). If no such snapshot has been taken, this will
* be null. * be null.
* *
* @type {Object} * @type {object}
* @default null * @default null
*/ */
this.clientState = null; this.clientState = null;
@@ -715,10 +715,10 @@ Guacamole.SessionRecording._Frame = function _Frame(timestamp, instructions) {
* *
* @private * @private
* @constructor * @constructor
* @param {String} opcode * @param {!string} opcode
* The opcode of this Guacamole instruction. * The opcode of this Guacamole instruction.
* *
* @param {String[]} args * @param {!string[]} args
* All arguments associated with this Guacamole instruction. * All arguments associated with this Guacamole instruction.
*/ */
Guacamole.SessionRecording._Frame.Instruction = function Instruction(opcode, args) { Guacamole.SessionRecording._Frame.Instruction = function Instruction(opcode, args) {
@@ -727,21 +727,21 @@ Guacamole.SessionRecording._Frame.Instruction = function Instruction(opcode, arg
* Reference to this Guacamole.SessionRecording._Frame.Instruction. * Reference to this Guacamole.SessionRecording._Frame.Instruction.
* *
* @private * @private
* @type {Guacamole.SessionRecording._Frame.Instruction} * @type {!Guacamole.SessionRecording._Frame.Instruction}
*/ */
var instruction = this; var instruction = this;
/** /**
* The opcode of this Guacamole instruction. * The opcode of this Guacamole instruction.
* *
* @type {String} * @type {!string}
*/ */
this.opcode = opcode; this.opcode = opcode;
/** /**
* All arguments associated with this Guacamole instruction. * All arguments associated with this Guacamole instruction.
* *
* @type {String[]} * @type {!string[]}
*/ */
this.args = args; this.args = args;
@@ -751,7 +751,7 @@ Guacamole.SessionRecording._Frame.Instruction = function Instruction(opcode, arg
* prefixes and various delimiters used by the Guacamole protocol; only * prefixes and various delimiters used by the Guacamole protocol; only
* the content of the opcode and each argument is taken into account. * the content of the opcode and each argument is taken into account.
* *
* @returns {Number} * @returns {!number}
* The approximate size of this instruction, in characters. * The approximate size of this instruction, in characters.
*/ */
this.getSize = function getSize() { this.getSize = function getSize() {
@@ -783,7 +783,7 @@ Guacamole.SessionRecording._PlaybackTunnel = function _PlaybackTunnel() {
* Reference to this Guacamole.SessionRecording._PlaybackTunnel. * Reference to this Guacamole.SessionRecording._PlaybackTunnel.
* *
* @private * @private
* @type {Guacamole.SessionRecording._PlaybackTunnel} * @type {!Guacamole.SessionRecording._PlaybackTunnel}
*/ */
var tunnel = this; var tunnel = this;
@@ -805,10 +805,10 @@ Guacamole.SessionRecording._PlaybackTunnel = function _PlaybackTunnel() {
* been received. If the oninstruction handler has not been set, this * been received. If the oninstruction handler has not been set, this
* function has no effect. * function has no effect.
* *
* @param {String} opcode * @param {!string} opcode
* The opcode of the Guacamole instruction. * The opcode of the Guacamole instruction.
* *
* @param {String[]} args * @param {!string[]} args
* All arguments associated with this Guacamole instruction. * All arguments associated with this Guacamole instruction.
*/ */
this.receiveInstruction = function receiveInstruction(opcode, args) { this.receiveInstruction = function receiveInstruction(opcode, args) {

View File

@@ -25,24 +25,27 @@ var Guacamole = Guacamole || {};
* included for debugging convenience. * included for debugging convenience.
* *
* @constructor * @constructor
* @param {Number} code * @param {!number} code
* The Guacamole status code, as defined by Guacamole.Status.Code. * The Guacamole status code, as defined by Guacamole.Status.Code.
* *
* @param {String} [message] * @param {string} [message]
* An optional human-readable message. * An optional human-readable message.
*/ */
Guacamole.Status = function(code, message) { Guacamole.Status = function(code, message) {
/** /**
* Reference to this Guacamole.Status. * Reference to this Guacamole.Status.
*
* @private * @private
* @type {!Guacamole.Status}
*/ */
var guac_status = this; var guac_status = this;
/** /**
* The Guacamole status code. * The Guacamole status code.
*
* @see Guacamole.Status.Code * @see Guacamole.Status.Code
* @type {Number} * @type {!number}
*/ */
this.code = code; this.code = code;
@@ -52,14 +55,15 @@ Guacamole.Status = function(code, message) {
* for debugging purposes only. For user feedback, it is better to translate * for debugging purposes only. For user feedback, it is better to translate
* the Guacamole status code into a message. * the Guacamole status code into a message.
* *
* @type {String} * @type {string}
*/ */
this.message = message; this.message = message;
/** /**
* Returns whether this status represents an error. * Returns whether this status represents an error.
* @returns {boolean} true if this status represents an error, false *
* otherwise. * @returns {!boolean}
* true if this status represents an error, false otherwise.
*/ */
this.isError = function() { this.isError = function() {
return guac_status.code < 0 || guac_status.code > 0x00FF; return guac_status.code < 0 || guac_status.code > 0x00FF;
@@ -75,28 +79,28 @@ Guacamole.Status.Code = {
/** /**
* The operation succeeded. * The operation succeeded.
* *
* @type {Number} * @type {!number}
*/ */
"SUCCESS": 0x0000, "SUCCESS": 0x0000,
/** /**
* The requested operation is unsupported. * The requested operation is unsupported.
* *
* @type {Number} * @type {!number}
*/ */
"UNSUPPORTED": 0x0100, "UNSUPPORTED": 0x0100,
/** /**
* The operation could not be performed due to an internal failure. * The operation could not be performed due to an internal failure.
* *
* @type {Number} * @type {!number}
*/ */
"SERVER_ERROR": 0x0200, "SERVER_ERROR": 0x0200,
/** /**
* The operation could not be performed as the server is busy. * The operation could not be performed as the server is busy.
* *
* @type {Number} * @type {!number}
*/ */
"SERVER_BUSY": 0x0201, "SERVER_BUSY": 0x0201,
@@ -104,7 +108,7 @@ Guacamole.Status.Code = {
* The operation could not be performed because the upstream server is not * The operation could not be performed because the upstream server is not
* responding. * responding.
* *
* @type {Number} * @type {!number}
*/ */
"UPSTREAM_TIMEOUT": 0x0202, "UPSTREAM_TIMEOUT": 0x0202,
@@ -112,7 +116,7 @@ Guacamole.Status.Code = {
* The operation was unsuccessful due to an error or otherwise unexpected * The operation was unsuccessful due to an error or otherwise unexpected
* condition of the upstream server. * condition of the upstream server.
* *
* @type {Number} * @type {!number}
*/ */
"UPSTREAM_ERROR": 0x0203, "UPSTREAM_ERROR": 0x0203,
@@ -120,7 +124,7 @@ Guacamole.Status.Code = {
* The operation could not be performed as the requested resource does not * The operation could not be performed as the requested resource does not
* exist. * exist.
* *
* @type {Number} * @type {!number}
*/ */
"RESOURCE_NOT_FOUND": 0x0204, "RESOURCE_NOT_FOUND": 0x0204,
@@ -128,7 +132,7 @@ Guacamole.Status.Code = {
* The operation could not be performed as the requested resource is * The operation could not be performed as the requested resource is
* already in use. * already in use.
* *
* @type {Number} * @type {!number}
*/ */
"RESOURCE_CONFLICT": 0x0205, "RESOURCE_CONFLICT": 0x0205,
@@ -136,7 +140,7 @@ Guacamole.Status.Code = {
* The operation could not be performed as the requested resource is now * The operation could not be performed as the requested resource is now
* closed. * closed.
* *
* @type {Number} * @type {!number}
*/ */
"RESOURCE_CLOSED": 0x0206, "RESOURCE_CLOSED": 0x0206,
@@ -144,7 +148,7 @@ Guacamole.Status.Code = {
* The operation could not be performed because the upstream server does * The operation could not be performed because the upstream server does
* not appear to exist. * not appear to exist.
* *
* @type {Number} * @type {!number}
*/ */
"UPSTREAM_NOT_FOUND": 0x0207, "UPSTREAM_NOT_FOUND": 0x0207,
@@ -152,7 +156,7 @@ Guacamole.Status.Code = {
* The operation could not be performed because the upstream server is not * The operation could not be performed because the upstream server is not
* available to service the request. * available to service the request.
* *
* @type {Number} * @type {!number}
*/ */
"UPSTREAM_UNAVAILABLE": 0x0208, "UPSTREAM_UNAVAILABLE": 0x0208,
@@ -160,7 +164,7 @@ Guacamole.Status.Code = {
* The session within the upstream server has ended because it conflicted * The session within the upstream server has ended because it conflicted
* with another session. * with another session.
* *
* @type {Number} * @type {!number}
*/ */
"SESSION_CONFLICT": 0x0209, "SESSION_CONFLICT": 0x0209,
@@ -168,21 +172,21 @@ Guacamole.Status.Code = {
* The session within the upstream server has ended because it appeared to * The session within the upstream server has ended because it appeared to
* be inactive. * be inactive.
* *
* @type {Number} * @type {!number}
*/ */
"SESSION_TIMEOUT": 0x020A, "SESSION_TIMEOUT": 0x020A,
/** /**
* The session within the upstream server has been forcibly terminated. * The session within the upstream server has been forcibly terminated.
* *
* @type {Number} * @type {!number}
*/ */
"SESSION_CLOSED": 0x020B, "SESSION_CLOSED": 0x020B,
/** /**
* The operation could not be performed because bad parameters were given. * The operation could not be performed because bad parameters were given.
* *
* @type {Number} * @type {!number}
*/ */
"CLIENT_BAD_REQUEST": 0x0300, "CLIENT_BAD_REQUEST": 0x0300,
@@ -190,7 +194,7 @@ Guacamole.Status.Code = {
* Permission was denied to perform the operation, as the user is not yet * Permission was denied to perform the operation, as the user is not yet
* authorized (not yet logged in, for example). * authorized (not yet logged in, for example).
* *
* @type {Number} * @type {!number}
*/ */
"CLIENT_UNAUTHORIZED": 0x0301, "CLIENT_UNAUTHORIZED": 0x0301,
@@ -198,28 +202,28 @@ Guacamole.Status.Code = {
* Permission was denied to perform the operation, and this permission will * Permission was denied to perform the operation, and this permission will
* not be granted even if the user is authorized. * not be granted even if the user is authorized.
* *
* @type {Number} * @type {!number}
*/ */
"CLIENT_FORBIDDEN": 0x0303, "CLIENT_FORBIDDEN": 0x0303,
/** /**
* The client took too long to respond. * The client took too long to respond.
* *
* @type {Number} * @type {!number}
*/ */
"CLIENT_TIMEOUT": 0x0308, "CLIENT_TIMEOUT": 0x0308,
/** /**
* The client sent too much data. * The client sent too much data.
* *
* @type {Number} * @type {!number}
*/ */
"CLIENT_OVERRUN": 0x030D, "CLIENT_OVERRUN": 0x030D,
/** /**
* The client sent data of an unsupported or unexpected type. * The client sent data of an unsupported or unexpected type.
* *
* @type {Number} * @type {!number}
*/ */
"CLIENT_BAD_TYPE": 0x030F, "CLIENT_BAD_TYPE": 0x030F,
@@ -227,7 +231,7 @@ Guacamole.Status.Code = {
* The operation failed because the current client is already using too * The operation failed because the current client is already using too
* many resources. * many resources.
* *
* @type {Number} * @type {!number}
*/ */
"CLIENT_TOO_MANY": 0x031D "CLIENT_TOO_MANY": 0x031D
@@ -237,11 +241,11 @@ Guacamole.Status.Code = {
* Returns the Guacamole protocol status code which most closely * Returns the Guacamole protocol status code which most closely
* represents the given HTTP status code. * represents the given HTTP status code.
* *
* @param {Number} status * @param {!number} status
* The HTTP status code to translate into a Guacamole protocol status * The HTTP status code to translate into a Guacamole protocol status
* code. * code.
* *
* @returns {Number} * @returns {!number}
* The Guacamole protocol status code which most closely represents the * The Guacamole protocol status code which most closely represents the
* given HTTP status code. * given HTTP status code.
*/ */
@@ -281,11 +285,11 @@ Guacamole.Status.Code.fromHTTPCode = function fromHTTPCode(status) {
* Returns the Guacamole protocol status code which most closely * Returns the Guacamole protocol status code which most closely
* represents the given WebSocket status code. * represents the given WebSocket status code.
* *
* @param {Number} code * @param {!number} code
* The WebSocket status code to translate into a Guacamole protocol * The WebSocket status code to translate into a Guacamole protocol
* status code. * status code.
* *
* @returns {Number} * @returns {!number}
* The Guacamole protocol status code which most closely represents the * The Guacamole protocol status code which most closely represents the
* given WebSocket status code. * given WebSocket status code.
*/ */

View File

@@ -25,21 +25,24 @@ var Guacamole = Guacamole || {};
* handlers on the given Guacamole.InputStream. * handlers on the given Guacamole.InputStream.
* *
* @constructor * @constructor
* @param {Guacamole.InputStream} stream The stream that data will be read * @param {!Guacamole.InputStream} stream
* from. * The stream that data will be read from.
*/ */
Guacamole.StringReader = function(stream) { Guacamole.StringReader = function(stream) {
/** /**
* Reference to this Guacamole.InputStream. * Reference to this Guacamole.InputStream.
*
* @private * @private
* @type {!Guacamole.StringReader}
*/ */
var guac_reader = this; var guac_reader = this;
/** /**
* Wrapped Guacamole.ArrayBufferReader. * Wrapped Guacamole.ArrayBufferReader.
*
* @private * @private
* @type {Guacamole.ArrayBufferReader} * @type {!Guacamole.ArrayBufferReader}
*/ */
var array_reader = new Guacamole.ArrayBufferReader(stream); var array_reader = new Guacamole.ArrayBufferReader(stream);
@@ -47,7 +50,7 @@ Guacamole.StringReader = function(stream) {
* The number of bytes remaining for the current codepoint. * The number of bytes remaining for the current codepoint.
* *
* @private * @private
* @type {Number} * @type {!number}
*/ */
var bytes_remaining = 0; var bytes_remaining = 0;
@@ -55,7 +58,7 @@ Guacamole.StringReader = function(stream) {
* The current codepoint value, as calculated from bytes read so far. * The current codepoint value, as calculated from bytes read so far.
* *
* @private * @private
* @type {Number} * @type {!number}
*/ */
var codepoint = 0; var codepoint = 0;
@@ -64,8 +67,11 @@ Guacamole.StringReader = function(stream) {
* the middle of a multibyte character. * the middle of a multibyte character.
* *
* @private * @private
* @param {ArrayBuffer} buffer Arbitrary UTF-8 data. * @param {!ArrayBuffer} buffer
* @return {string} A decoded Unicode string. * Arbitrary UTF-8 data.
*
* @return {!string}
* A decoded Unicode string.
*/ */
function __decode_utf8(buffer) { function __decode_utf8(buffer) {
@@ -154,7 +160,8 @@ Guacamole.StringReader = function(stream) {
* Fired once for every blob of text data received. * Fired once for every blob of text data received.
* *
* @event * @event
* @param {String} text The data packet received. * @param {!string} text
* The data packet received.
*/ */
this.ontext = null; this.ontext = null;

View File

@@ -24,33 +24,40 @@ var Guacamole = Guacamole || {};
* data. * data.
* *
* @constructor * @constructor
* @param {Guacamole.OutputStream} stream The stream that data will be written * @param {!Guacamole.OutputStream} stream
* to. * The stream that data will be written to.
*/ */
Guacamole.StringWriter = function(stream) { Guacamole.StringWriter = function(stream) {
/** /**
* Reference to this Guacamole.StringWriter. * Reference to this Guacamole.StringWriter.
*
* @private * @private
* @type {!Guacamole.StringWriter}
*/ */
var guac_writer = this; var guac_writer = this;
/** /**
* Wrapped Guacamole.ArrayBufferWriter. * Wrapped Guacamole.ArrayBufferWriter.
*
* @private * @private
* @type {Guacamole.ArrayBufferWriter} * @type {!Guacamole.ArrayBufferWriter}
*/ */
var array_writer = new Guacamole.ArrayBufferWriter(stream); var array_writer = new Guacamole.ArrayBufferWriter(stream);
/** /**
* Internal buffer for UTF-8 output. * Internal buffer for UTF-8 output.
*
* @private * @private
* @type {!Uint8Array}
*/ */
var buffer = new Uint8Array(8192); var buffer = new Uint8Array(8192);
/** /**
* The number of bytes currently in the buffer. * The number of bytes currently in the buffer.
*
* @private * @private
* @type {!number}
*/ */
var length = 0; var length = 0;
@@ -65,8 +72,8 @@ Guacamole.StringWriter = function(stream) {
* updating the length appropriately. * updating the length appropriately.
* *
* @private * @private
* @param {Number} bytes The number of bytes to add to the underlying * @param {!number} bytes
* buffer. * The number of bytes to add to the underlying buffer.
*/ */
function __expand(bytes) { function __expand(bytes) {
@@ -86,8 +93,8 @@ Guacamole.StringWriter = function(stream) {
* buffer if necessary. The character will be encoded as UTF-8. * buffer if necessary. The character will be encoded as UTF-8.
* *
* @private * @private
* @param {Number} codepoint The codepoint of the Unicode character to * @param {!number} codepoint
* append. * The codepoint of the Unicode character to append.
*/ */
function __append_utf8(codepoint) { function __append_utf8(codepoint) {
@@ -144,8 +151,11 @@ Guacamole.StringWriter = function(stream) {
* the resulting bytes. * the resulting bytes.
* *
* @private * @private
* @param {String} text The string to encode as UTF-8. * @param {!string} text
* @return {Uint8Array} The encoded UTF-8 data. * The string to encode as UTF-8.
*
* @return {!Uint8Array}
* The encoded UTF-8 data.
*/ */
function __encode_utf8(text) { function __encode_utf8(text) {
@@ -167,7 +177,8 @@ Guacamole.StringWriter = function(stream) {
/** /**
* Sends the given text. * Sends the given text.
* *
* @param {String} text The text to send. * @param {!string} text
* The text to send.
*/ */
this.sendText = function(text) { this.sendText = function(text) {
if (text.length) if (text.length)
@@ -184,8 +195,10 @@ Guacamole.StringWriter = function(stream) {
/** /**
* Fired for received data, if acknowledged by the server. * Fired for received data, if acknowledged by the server.
*
* @event * @event
* @param {Guacamole.Status} status The status of the operation. * @param {!Guacamole.Status} status
* The status of the operation.
*/ */
this.onack = null; this.onack = null;

View File

@@ -27,7 +27,7 @@ var Guacamole = Guacamole || {};
* *
* @constructor * @constructor
* @augments Guacamole.Event.Target * @augments Guacamole.Event.Target
* @param {Element} element * @param {!Element} element
* The Element to use to provide touch events. * The Element to use to provide touch events.
*/ */
Guacamole.Touch = function Touch(element) { Guacamole.Touch = function Touch(element) {
@@ -38,7 +38,7 @@ Guacamole.Touch = function Touch(element) {
* Reference to this Guacamole.Touch. * Reference to this Guacamole.Touch.
* *
* @private * @private
* @type {Guacamole.Touch} * @type {!Guacamole.Touch}
*/ */
var guacTouch = this; var guacTouch = this;
@@ -48,14 +48,14 @@ Guacamole.Touch = function Touch(element) {
* *
* @private * @private
* @constant * @constant
* @type {Number} * @type {!number}
*/ */
var DEFAULT_CONTACT_RADIUS = Math.floor(16 * window.devicePixelRatio); var DEFAULT_CONTACT_RADIUS = Math.floor(16 * window.devicePixelRatio);
/** /**
* The set of all active touches, stored by their unique identifiers. * The set of all active touches, stored by their unique identifiers.
* *
* @type {Object.<Number, Guacamole.Touch.State>} * @type {!Object.<Number, Guacamole.Touch.State>}
*/ */
this.touches = {}; this.touches = {};
@@ -70,7 +70,7 @@ Guacamole.Touch = function Touch(element) {
* associated with this Guacamole.Touch. * associated with this Guacamole.Touch.
* *
* @event Guacamole.Touch#touchstart * @event Guacamole.Touch#touchstart
* @param {Guacamole.Touch.Event} event * @param {!Guacamole.Touch.Event} event
* A {@link Guacamole.Touch.Event} object representing the "touchstart" * A {@link Guacamole.Touch.Event} object representing the "touchstart"
* event. * event.
*/ */
@@ -80,7 +80,7 @@ Guacamole.Touch = function Touch(element) {
* associated with this Guacamole.Touch. * associated with this Guacamole.Touch.
* *
* @event Guacamole.Touch#touchmove * @event Guacamole.Touch#touchmove
* @param {Guacamole.Touch.Event} event * @param {!Guacamole.Touch.Event} event
* A {@link Guacamole.Touch.Event} object representing the "touchmove" * A {@link Guacamole.Touch.Event} object representing the "touchmove"
* event. * event.
*/ */
@@ -90,7 +90,7 @@ Guacamole.Touch = function Touch(element) {
* associated with this Guacamole.Touch. * associated with this Guacamole.Touch.
* *
* @event Guacamole.Touch#touchend * @event Guacamole.Touch#touchend
* @param {Guacamole.Touch.Event} event * @param {!Guacamole.Touch.Event} event
* A {@link Guacamole.Touch.Event} object representing the "touchend" * A {@link Guacamole.Touch.Event} object representing the "touchend"
* event. * event.
*/ */
@@ -190,7 +190,7 @@ Guacamole.Touch = function Touch(element) {
* *
* @constructor * @constructor
* @augments Guacamole.Position * @augments Guacamole.Position
* @param {Guacamole.Touch.State|Object} [template={}] * @param {Guacamole.Touch.State|object} [template={}]
* The object whose properties should be copied within the new * The object whose properties should be copied within the new
* Guacamole.Touch.State. * Guacamole.Touch.State.
*/ */
@@ -204,7 +204,7 @@ Guacamole.Touch.State = function State(template) {
* An arbitrary integer ID which uniquely identifies this contact relative * An arbitrary integer ID which uniquely identifies this contact relative
* to other active contacts. * to other active contacts.
* *
* @type {Number} * @type {!number}
* @default 0 * @default 0
*/ */
this.id = template.id || 0; this.id = template.id || 0;
@@ -213,7 +213,7 @@ Guacamole.Touch.State = function State(template) {
* The Y radius of the ellipse covering the general area of the touch * The Y radius of the ellipse covering the general area of the touch
* contact, in pixels. * contact, in pixels.
* *
* @type {Number} * @type {!number}
* @default 0 * @default 0
*/ */
this.radiusX = template.radiusX || 0; this.radiusX = template.radiusX || 0;
@@ -222,7 +222,7 @@ Guacamole.Touch.State = function State(template) {
* The X radius of the ellipse covering the general area of the touch * The X radius of the ellipse covering the general area of the touch
* contact, in pixels. * contact, in pixels.
* *
* @type {Number} * @type {!number}
* @default 0 * @default 0
*/ */
this.radiusY = template.radiusY || 0; this.radiusY = template.radiusY || 0;
@@ -231,7 +231,7 @@ Guacamole.Touch.State = function State(template) {
* The rough angle of clockwise rotation of the general area of the touch * The rough angle of clockwise rotation of the general area of the touch
* contact, in degrees. * contact, in degrees.
* *
* @type {Number} * @type {!number}
* @default 0.0 * @default 0.0
*/ */
this.angle = template.angle || 0.0; this.angle = template.angle || 0.0;
@@ -241,7 +241,7 @@ Guacamole.Touch.State = function State(template) {
* (the touch has been lifted) and 1 is maximum force (the maximum amount * (the touch has been lifted) and 1 is maximum force (the maximum amount
* of force representable by the device). * of force representable by the device).
* *
* @type {Number} * @type {!number}
* @default 1.0 * @default 1.0
*/ */
this.force = template.force || 1.0; this.force = template.force || 1.0;
@@ -256,14 +256,14 @@ Guacamole.Touch.State = function State(template) {
* *
* @constructor * @constructor
* @augments Guacamole.Event.DOMEvent * @augments Guacamole.Event.DOMEvent
* @param {String} type * @param {!string} type
* The name of the touch event type. Possible values are "touchstart", * The name of the touch event type. Possible values are "touchstart",
* "touchmove", and "touchend". * "touchmove", and "touchend".
* *
* @param {TouchEvent} event * @param {!TouchEvent} event
* The DOM touch event that produced this Guacamole.Touch.Event. * The DOM touch event that produced this Guacamole.Touch.Event.
* *
* @param {Guacamole.Touch.State} state * @param {!Guacamole.Touch.State} state
* The state of the touch contact associated with this event. * The state of the touch contact associated with this event.
*/ */
Guacamole.Touch.Event = function TouchEvent(type, event, state) { Guacamole.Touch.Event = function TouchEvent(type, event, state) {
@@ -273,7 +273,7 @@ Guacamole.Touch.Event = function TouchEvent(type, event, state) {
/** /**
* The state of the touch contact associated with this event. * The state of the touch contact associated with this event.
* *
* @type{Guacamole.Touch.State} * @type {!Guacamole.Touch.State}
*/ */
this.state = state; this.state = state;

View File

@@ -35,7 +35,8 @@ Guacamole.Tunnel = function() {
* typically used for authentication. The format of data accepted is * typically used for authentication. The format of data accepted is
* up to the tunnel implementation. * up to the tunnel implementation.
* *
* @param {String} data The data to send to the tunnel when connecting. * @param {string} [data]
* The data to send to the tunnel when connecting.
*/ */
this.connect = function(data) {}; this.connect = function(data) {};
@@ -59,7 +60,7 @@ Guacamole.Tunnel = function() {
* event if the new state is different and a handler has been defined. * event if the new state is different and a handler has been defined.
* *
* @private * @private
* @param {Number} state * @param {!number} state
* The new state of this tunnel. * The new state of this tunnel.
*/ */
this.setState = function(state) { this.setState = function(state) {
@@ -78,7 +79,7 @@ Guacamole.Tunnel = function() {
* onuuid event if a handler has been defined. * onuuid event if a handler has been defined.
* *
* @private * @private
* @param {String} uuid * @param {string} uuid
* The new state of this tunnel. * The new state of this tunnel.
*/ */
this.setUUID = function setUUID(uuid) { this.setUUID = function setUUID(uuid) {
@@ -90,7 +91,7 @@ Guacamole.Tunnel = function() {
/** /**
* Returns whether this tunnel is currently connected. * Returns whether this tunnel is currently connected.
* *
* @returns {boolean} * @returns {!boolean}
* true if this tunnel is currently connected, false otherwise. * true if this tunnel is currently connected, false otherwise.
*/ */
this.isConnected = function isConnected() { this.isConnected = function isConnected() {
@@ -101,7 +102,7 @@ Guacamole.Tunnel = function() {
/** /**
* The current state of this tunnel. * The current state of this tunnel.
* *
* @type {Number} * @type {!number}
*/ */
this.state = Guacamole.Tunnel.State.CONNECTING; this.state = Guacamole.Tunnel.State.CONNECTING;
@@ -110,7 +111,7 @@ Guacamole.Tunnel = function() {
* milliseconds. If data is not received within this amount of time, * milliseconds. If data is not received within this amount of time,
* the tunnel is closed with an error. The default value is 15000. * the tunnel is closed with an error. The default value is 15000.
* *
* @type {Number} * @type {!number}
*/ */
this.receiveTimeout = 15000; this.receiveTimeout = 15000;
@@ -121,7 +122,7 @@ Guacamole.Tunnel = function() {
* the connection appears unresponsive and may close. The default value is * the connection appears unresponsive and may close. The default value is
* 1500. * 1500.
* *
* @type {Number} * @type {!number}
*/ */
this.unstableThreshold = 1500; this.unstableThreshold = 1500;
@@ -129,7 +130,7 @@ Guacamole.Tunnel = function() {
* The UUID uniquely identifying this tunnel. If not yet known, this will * The UUID uniquely identifying this tunnel. If not yet known, this will
* be null. * be null.
* *
* @type {String} * @type {string}
*/ */
this.uuid = null; this.uuid = null;
@@ -137,7 +138,7 @@ Guacamole.Tunnel = function() {
* Fired when the UUID that uniquely identifies this tunnel is known. * Fired when the UUID that uniquely identifies this tunnel is known.
* *
* @event * @event
* @param {String} * @param {!string}
* The UUID uniquely identifying this tunnel. * The UUID uniquely identifying this tunnel.
*/ */
this.onuuid = null; this.onuuid = null;
@@ -146,8 +147,8 @@ Guacamole.Tunnel = function() {
* Fired whenever an error is encountered by the tunnel. * Fired whenever an error is encountered by the tunnel.
* *
* @event * @event
* @param {Guacamole.Status} status A status object which describes the * @param {!Guacamole.Status} status
* error. * A status object which describes the error.
*/ */
this.onerror = null; this.onerror = null;
@@ -155,7 +156,8 @@ Guacamole.Tunnel = function() {
* Fired whenever the state of the tunnel changes. * Fired whenever the state of the tunnel changes.
* *
* @event * @event
* @param {Number} state The new state of the client. * @param {!number} state
* The new state of the client.
*/ */
this.onstatechange = null; this.onstatechange = null;
@@ -163,9 +165,11 @@ Guacamole.Tunnel = function() {
* Fired once for every complete Guacamole instruction received, in order. * Fired once for every complete Guacamole instruction received, in order.
* *
* @event * @event
* @param {String} opcode The Guacamole instruction opcode. * @param {!string} opcode
* @param {Array} parameters The parameters provided for the instruction, * The Guacamole instruction opcode.
* if any. *
* @param {!string[]} parameters
* The parameters provided for the instruction, if any.
*/ */
this.oninstruction = null; this.oninstruction = null;
@@ -180,12 +184,14 @@ Guacamole.Tunnel = function() {
* connection stability test pings/responses. * connection stability test pings/responses.
* *
* @constant * @constant
* @type {String} * @type {!string}
*/ */
Guacamole.Tunnel.INTERNAL_DATA_OPCODE = ''; Guacamole.Tunnel.INTERNAL_DATA_OPCODE = '';
/** /**
* All possible tunnel states. * All possible tunnel states.
*
* @type {!Object.<string, number>}
*/ */
Guacamole.Tunnel.State = { Guacamole.Tunnel.State = {
@@ -193,14 +199,14 @@ Guacamole.Tunnel.State = {
* A connection is in pending. It is not yet known whether connection was * A connection is in pending. It is not yet known whether connection was
* successful. * successful.
* *
* @type {Number} * @type {!number}
*/ */
"CONNECTING": 0, "CONNECTING": 0,
/** /**
* Connection was successful, and data is being received. * Connection was successful, and data is being received.
* *
* @type {Number} * @type {!number}
*/ */
"OPEN": 1, "OPEN": 1,
@@ -209,7 +215,7 @@ Guacamole.Tunnel.State = {
* tunnel may have been explicitly closed by either side, or an error may * tunnel may have been explicitly closed by either side, or an error may
* have occurred. * have occurred.
* *
* @type {Number} * @type {!number}
*/ */
"CLOSED": 2, "CLOSED": 2,
@@ -217,7 +223,7 @@ Guacamole.Tunnel.State = {
* The connection is open, but communication through the tunnel appears to * The connection is open, but communication through the tunnel appears to
* be disrupted, and the connection may close as a result. * be disrupted, and the connection may close as a result.
* *
* @type {Number} * @type {!number}
*/ */
"UNSTABLE" : 3 "UNSTABLE" : 3
@@ -229,15 +235,15 @@ Guacamole.Tunnel.State = {
* @constructor * @constructor
* @augments Guacamole.Tunnel * @augments Guacamole.Tunnel
* *
* @param {String} tunnelURL * @param {!string} tunnelURL
* The URL of the HTTP tunneling service. * The URL of the HTTP tunneling service.
* *
* @param {Boolean} [crossDomain=false] * @param {boolean} [crossDomain=false]
* Whether tunnel requests will be cross-domain, and thus must use CORS * Whether tunnel requests will be cross-domain, and thus must use CORS
* mechanisms and headers. By default, it is assumed that tunnel requests * mechanisms and headers. By default, it is assumed that tunnel requests
* will be made to the same domain. * will be made to the same domain.
* *
* @param {Object} [extraTunnelHeaders={}] * @param {object} [extraTunnelHeaders={}]
* Key value pairs containing the header names and values of any additional * Key value pairs containing the header names and values of any additional
* headers to be sent in tunnel requests. By default, no extra headers will * headers to be sent in tunnel requests. By default, no extra headers will
* be added. * be added.
@@ -246,7 +252,9 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) {
/** /**
* Reference to this HTTP tunnel. * Reference to this HTTP tunnel.
*
* @private * @private
* @type {!Guacamole.HTTPTunnel}
*/ */
var tunnel = this; var tunnel = this;
@@ -269,7 +277,9 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) {
/** /**
* The current receive timeout ID, if any. * The current receive timeout ID, if any.
*
* @private * @private
* @type {number}
*/ */
var receive_timeout = null; var receive_timeout = null;
@@ -277,7 +287,7 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) {
* The current connection stability timeout ID, if any. * The current connection stability timeout ID, if any.
* *
* @private * @private
* @type {Number} * @type {number}
*/ */
var unstableTimeout = null; var unstableTimeout = null;
@@ -286,7 +296,7 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) {
* will only be set upon successful connection. * will only be set upon successful connection.
* *
* @private * @private
* @type {Number} * @type {number}
*/ */
var pingInterval = null; var pingInterval = null;
@@ -296,7 +306,7 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) {
* *
* @private * @private
* @constant * @constant
* @type {Number} * @type {!number}
*/ */
var PING_FREQUENCY = 500; var PING_FREQUENCY = 500;
@@ -306,6 +316,7 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) {
* tokens, etc. * tokens, etc.
* *
* @private * @private
* @type {!object}
*/ */
var extraHeaders = extraTunnelHeaders || {}; var extraHeaders = extraTunnelHeaders || {};
@@ -315,7 +326,7 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) {
* *
* @private * @private
* @constant * @constant
* @type {string} * @type {!string}
*/ */
var TUNNEL_TOKEN_HEADER = 'Guacamole-Tunnel-Token'; var TUNNEL_TOKEN_HEADER = 'Guacamole-Tunnel-Token';
@@ -331,13 +342,12 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) {
/** /**
* Adds the configured additional headers to the given request. * Adds the configured additional headers to the given request.
* *
* @param {XMLHttpRequest} request * @private
* @param {!XMLHttpRequest} request
* The request where the configured extra headers will be added. * The request where the configured extra headers will be added.
* *
* @param {Object} headers * @param {!object} headers
* The headers to be added to the request. * The headers to be added to the request.
*
* @private
*/ */
function addExtraHeaders(request, headers) { function addExtraHeaders(request, headers) {
for (var name in headers) { for (var name in headers) {
@@ -379,8 +389,8 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) {
* an error status. * an error status.
* *
* @private * @private
* @param {Guacamole.Status} status The status causing the connection to * @param {!Guacamole.Status} status
* close; * The status causing the connection to close;
*/ */
function close_tunnel(status) { function close_tunnel(status) {
@@ -430,8 +440,11 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) {
* element in a Guacamole instruction. * element in a Guacamole instruction.
* *
* @private * @private
* @param value The value to convert. * @param value
* @return {string} The converted value. * The value to convert.
*
* @return {!string}
* The converted value.
*/ */
function getElement(value) { function getElement(value) {
var string = new String(value); var string = new String(value);
@@ -793,25 +806,32 @@ Guacamole.HTTPTunnel.prototype = new Guacamole.Tunnel();
* *
* @constructor * @constructor
* @augments Guacamole.Tunnel * @augments Guacamole.Tunnel
* @param {String} tunnelURL The URL of the WebSocket tunneling service. * @param {!string} tunnelURL
* The URL of the WebSocket tunneling service.
*/ */
Guacamole.WebSocketTunnel = function(tunnelURL) { Guacamole.WebSocketTunnel = function(tunnelURL) {
/** /**
* Reference to this WebSocket tunnel. * Reference to this WebSocket tunnel.
*
* @private * @private
* @type {Guacamole.WebSocketTunnel}
*/ */
var tunnel = this; var tunnel = this;
/** /**
* The WebSocket used by this tunnel. * The WebSocket used by this tunnel.
*
* @private * @private
* @type {WebSocket}
*/ */
var socket = null; var socket = null;
/** /**
* The current receive timeout ID, if any. * The current receive timeout ID, if any.
*
* @private * @private
* @type {number}
*/ */
var receive_timeout = null; var receive_timeout = null;
@@ -819,7 +839,7 @@ Guacamole.WebSocketTunnel = function(tunnelURL) {
* The current connection stability timeout ID, if any. * The current connection stability timeout ID, if any.
* *
* @private * @private
* @type {Number} * @type {number}
*/ */
var unstableTimeout = null; var unstableTimeout = null;
@@ -828,14 +848,16 @@ Guacamole.WebSocketTunnel = function(tunnelURL) {
* will only be set upon successful connection. * will only be set upon successful connection.
* *
* @private * @private
* @type {Number} * @type {number}
*/ */
var pingInterval = null; var pingInterval = null;
/** /**
* The WebSocket protocol corresponding to the protocol used for the current * The WebSocket protocol corresponding to the protocol used for the current
* location. * location.
*
* @private * @private
* @type {!Object.<string, string>}
*/ */
var ws_protocol = { var ws_protocol = {
"http:": "ws:", "http:": "ws:",
@@ -848,7 +870,7 @@ Guacamole.WebSocketTunnel = function(tunnelURL) {
* *
* @private * @private
* @constant * @constant
* @type {Number} * @type {!number}
*/ */
var PING_FREQUENCY = 500; var PING_FREQUENCY = 500;
@@ -919,8 +941,8 @@ Guacamole.WebSocketTunnel = function(tunnelURL) {
* an error status. * an error status.
* *
* @private * @private
* @param {Guacamole.Status} status The status causing the connection to * @param {!Guacamole.Status} status
* close; * The status causing the connection to close;
*/ */
function close_tunnel(status) { function close_tunnel(status) {
@@ -961,8 +983,11 @@ Guacamole.WebSocketTunnel = function(tunnelURL) {
* element in a Guacamole instruction. * element in a Guacamole instruction.
* *
* @private * @private
* @param value The value to convert. * @param {*} value
* @return {string} The converted value. * The value to convert.
*
* @return {!string}
* The converted value.
*/ */
function getElement(value) { function getElement(value) {
var string = new String(value); var string = new String(value);
@@ -1113,7 +1138,7 @@ Guacamole.WebSocketTunnel.prototype = new Guacamole.Tunnel();
* *
* @constructor * @constructor
* @augments Guacamole.Tunnel * @augments Guacamole.Tunnel
* @param {...*} tunnelChain * @param {...Guacamole.Tunnel} tunnelChain
* The tunnels to use, in order of priority. * The tunnels to use, in order of priority.
*/ */
Guacamole.ChainedTunnel = function(tunnelChain) { Guacamole.ChainedTunnel = function(tunnelChain) {
@@ -1155,7 +1180,8 @@ Guacamole.ChainedTunnel = function(tunnelChain) {
* Sets the current tunnel. * Sets the current tunnel.
* *
* @private * @private
* @param {Guacamole.Tunnel} tunnel The tunnel to set as the current tunnel. * @param {!Guacamole.Tunnel} tunnel
* The tunnel to set as the current tunnel.
*/ */
function attach(tunnel) { function attach(tunnel) {
@@ -1297,15 +1323,15 @@ Guacamole.ChainedTunnel.prototype = new Guacamole.Tunnel();
* *
* @constructor * @constructor
* @augments Guacamole.Tunnel * @augments Guacamole.Tunnel
* @param {String} url * @param {!string} url
* The URL of a Guacamole protocol dump. * The URL of a Guacamole protocol dump.
* *
* @param {Boolean} [crossDomain=false] * @param {boolean} [crossDomain=false]
* Whether tunnel requests will be cross-domain, and thus must use CORS * Whether tunnel requests will be cross-domain, and thus must use CORS
* mechanisms and headers. By default, it is assumed that tunnel requests * mechanisms and headers. By default, it is assumed that tunnel requests
* will be made to the same domain. * will be made to the same domain.
* *
* @param {Object} [extraTunnelHeaders={}] * @param {object} [extraTunnelHeaders={}]
* Key value pairs containing the header names and values of any additional * Key value pairs containing the header names and values of any additional
* headers to be sent in tunnel requests. By default, no extra headers will * headers to be sent in tunnel requests. By default, no extra headers will
* be added. * be added.
@@ -1334,16 +1360,17 @@ Guacamole.StaticHTTPTunnel = function StaticHTTPTunnel(url, crossDomain, extraTu
* tokens, etc. * tokens, etc.
* *
* @private * @private
* @type {!object}
*/ */
var extraHeaders = extraTunnelHeaders || {}; var extraHeaders = extraTunnelHeaders || {};
/** /**
* Adds the configured additional headers to the given request. * Adds the configured additional headers to the given request.
* *
* @param {XMLHttpRequest} request * @param {!XMLHttpRequest} request
* The request where the configured extra headers will be added. * The request where the configured extra headers will be added.
* *
* @param {Object} headers * @param {!object} headers
* The headers to be added to the request. * The headers to be added to the request.
* *
* @private * @private

View File

@@ -25,6 +25,6 @@ var Guacamole = Guacamole || {};
* used in downstream applications as a sanity check that the proper version * used in downstream applications as a sanity check that the proper version
* of the APIs is being used (in case an older version is cached, for example). * of the APIs is being used (in case an older version is cached, for example).
* *
* @type {String} * @type {!string}
*/ */
Guacamole.API_VERSION = "1.4.0"; Guacamole.API_VERSION = "1.4.0";

View File

@@ -47,10 +47,10 @@ Guacamole.VideoPlayer = function VideoPlayer() {
* implementation of Guacamole.VideoPlayer, and thus will be properly handled * implementation of Guacamole.VideoPlayer, and thus will be properly handled
* by Guacamole.VideoPlayer.getInstance(). * by Guacamole.VideoPlayer.getInstance().
* *
* @param {String} mimetype * @param {!string} mimetype
* The mimetype to check. * The mimetype to check.
* *
* @returns {boolean} * @returns {!boolean}
* true if the given mimetype is supported by any built-in * true if the given mimetype is supported by any built-in
* Guacamole.VideoPlayer, false otherwise. * Guacamole.VideoPlayer, false otherwise.
*/ */
@@ -68,7 +68,7 @@ Guacamole.VideoPlayer.isSupportedType = function isSupportedType(mimetype) {
* mimetypes themselves will be listed. Any mimetype parameters, even required * mimetypes themselves will be listed. Any mimetype parameters, even required
* ones, will not be included in the list. * ones, will not be included in the list.
* *
* @returns {string[]} * @returns {!string[]}
* A list of all mimetypes supported by any built-in Guacamole.VideoPlayer, * A list of all mimetypes supported by any built-in Guacamole.VideoPlayer,
* excluding any parameters. * excluding any parameters.
*/ */
@@ -85,14 +85,14 @@ Guacamole.VideoPlayer.getSupportedTypes = function getSupportedTypes() {
* video format. If support for the given video format is not available, null * video format. If support for the given video format is not available, null
* is returned. * is returned.
* *
* @param {Guacamole.InputStream} stream * @param {!Guacamole.InputStream} stream
* The Guacamole.InputStream to read video data from. * The Guacamole.InputStream to read video data from.
* *
* @param {Guacamole.Display.VisibleLayer} layer * @param {!Guacamole.Display.VisibleLayer} layer
* The destination layer in which this Guacamole.VideoPlayer should play * The destination layer in which this Guacamole.VideoPlayer should play
* the received video data. * the received video data.
* *
* @param {String} mimetype * @param {!string} mimetype
* The mimetype of the video data in the provided stream. * The mimetype of the video data in the provided stream.
* *
* @return {Guacamole.VideoPlayer} * @return {Guacamole.VideoPlayer}

View File

@@ -27,6 +27,8 @@ describe("Guacamole.Event", function EventSpec() {
* *
* @constructor * @constructor
* @augments Guacamole.Event * @augments Guacamole.Event
* @param {object} value
* An arbitrary value to expose to the handler of the event.
*/ */
var TestEvent = function TestEvent(value) { var TestEvent = function TestEvent(value) {
@@ -35,7 +37,7 @@ describe("Guacamole.Event", function EventSpec() {
/** /**
* An arbitrary value to expose to the handler of this event. * An arbitrary value to expose to the handler of this event.
* *
* @type {Object} * @type {object}
*/ */
this.value = value; this.value = value;