@illgrenoble/guacamole-common-js
Version:
Guacamole common js as an NPM module
1,172 lines (1,074 loc) • 108 kB
TypeScript
declare module '@illgrenoble/guacamole-common-js' {
/**
* Guacamole protocol client. Given a {@link Guacamole.Tunnel},
* automatically handles incoming and outgoing Guacamole instructions via the
* provided tunnel, updating its display using one or more canvas elements.
*/
class Client {
/**
* @param {Guacamole.Tunnel} tunnel The tunnel to use to send and receive
* Guacamole instructions.
*/
constructor(tunnel: Tunnel);
/**
* Produces an opaque representation of Guacamole.Client state which can be
* later imported through a call to importState(). This object is
* effectively an independent, compressed snapshot of protocol and display
* state. Invoking this function implicitly flushes the display.
*
* @param {function} callback
* Callback which should be invoked once the state object is ready. The
* state object will be passed to the callback as the sole parameter.
* This callback may be invoked immediately, or later as the display
* finishes rendering and becomes ready.
*/
exportState(callback: any): void;
/**
* Restores Guacamole.Client protocol and display state based on an opaque
* object from a prior call to exportState(). The Guacamole.Client instance
* used to that state need not be the same as this instance.
*
* @param {Object} state
* An opaque representation of Guacamole.Client state from a prior call
* to exportState().
*
* @param {function} [callback]
* The function to invoke when state has finished being imported. This
* may happen immediately, or later as images within the provided state
* object are loaded.
*/
importState(state: any, callback: any): void;
/**
* Returns the underlying display of this Guacamole.Client. The display
* contains an Element which can be added to the DOM, causing the
* display to become visible.
*
* @return {Guacamole.Display} The underlying display of this
* Guacamole.Client.
*/
getDisplay(): Display;
/**
* Sends a disconnect instruction to the server and closes the tunnel.
*/
disconnect(): void;
/**
* Connects the underlying tunnel of this Guacamole.Client, passing the
* given arbitrary data to the tunnel during the connection process.
*
* @param data Arbitrary connection data to be sent to the underlying
* tunnel during the connection process.
* @throws {Guacamole.Status} If an error occurs during connection.
*/
connect(data: any): void;
/**
* Sends a mouse event having the properties provided by the given mouse
* state.
*
* @param {Guacamole.Mouse.State} mouseState The state of the mouse to send
* in the mouse event.
*/
sendMouseState(mouseState: Mouse.State): void;
/**
* Sends a key event having the given properties as if the user
* pressed or released a key.
*
* @param {Boolean} pressed Whether the key is pressed (true) or released
* (false).
* @param {Number} keysym The keysym of the key being pressed or released.
*/
sendKeyEvent(pressed: number, keysym: number): void;
/**
* Sends the current size of the screen.
*
* @param {Number} width The width of the screen.
* @param {Number} height The height of the screen.
*/
sendSize(width: number, height: number): void;
/**
* Sets the clipboard of the remote client to the given text data.
*
* @deprecated Use createClipboardStream() instead.
* @param {String} data The data to send as the clipboard contents.
*/
setClipboard(data: string): void;
/**
* Allocates an available stream index and creates a new
* Guacamole.OutputStream using that index, associating the resulting
* stream with this Guacamole.Client. Note that this stream will not yet
* exist as far as the other end of the Guacamole connection is concerned.
* Streams exist within the Guacamole protocol only when referenced by an
* instruction which creates the stream, such as a "clipboard", "file", or
* "pipe" instruction.
*
* @returns {Guacamole.OutputStream}
* A new Guacamole.OutputStream with a newly-allocated index and
* associated with this Guacamole.Client.
*/
createOutputStream(): OutputStream;
/**
* Opens a new audio stream for writing, where audio data having the give
* mimetype will be sent along the returned stream. The instruction
* necessary to create this stream will automatically be sent.
*
* @param {String} mimetype
* The mimetype of the audio data that will be sent along the returned
* stream.
*
* @return {Guacamole.OutputStream}
* The created audio stream.
*/
createAudioStream(mimetype: string): OutputStream;
/**
* Opens a new file for writing, having the given index, mimetype and
* filename. The instruction necessary to create this stream will
* automatically be sent.
*
* @param {String} mimetype The mimetype of the file being sent.
* @param {String} filename The filename of the file being sent.
* @return {Guacamole.OutputStream} The created file stream.
*/
createFileStream(mimetype: string, filename: string): OutputStream;
/**
* Opens a new pipe for writing, having the given name and mimetype. The
* instruction necessary to create this stream will automatically be sent.
*
* @param {String} mimetype The mimetype of the data being sent.
* @param {String} name The name of the pipe.
* @return {Guacamole.OutputStream} The created file stream.
*/
createPipeStream(mimetype: string, name: string): OutputStream;
/**
* Opens a new clipboard object for writing, having the given mimetype. The
* instruction necessary to create this stream will automatically be sent.
*
* @param {String} mimetype The mimetype of the data being sent.
* @param {String} name The name of the pipe.
* @return {Guacamole.OutputStream} The created file stream.
*/
createClipboardStream(mimetype: string): OutputStream;
/**
* Creates a new output stream associated with the given object and having
* the given mimetype and name. The legality of a mimetype and name is
* dictated by the object itself. The instruction necessary to create this
* stream will automatically be sent.
*
* @param {Number} index
* The index of the object for which the output stream is being
* created.
*
* @param {String} mimetype
* The mimetype of the data which will be sent to the output stream.
*
* @param {String} name
* The defined name of an output stream within the given object.
*
* @returns {Guacamole.OutputStream}
* An output stream which will write blobs to the named output stream
* of the given object.
*/
createObjectOutputStream(index: number, mimetype: string, name: string): OutputStream;
/**
* Requests read access to the input stream having the given name. If
* successful, a new input stream will be created.
*
* @param {Number} index
* The index of the object from which the input stream is being
* requested.
*
* @param {String} name
* The name of the input stream to request.
*/
requestObjectInputStream(index: number, name: string): void;
/**
* Acknowledge receipt of a blob on the stream with the given index.
*
* @param {Number} index The index of the stream associated with the
* received blob.
* @param {String} message A human-readable message describing the error
* or status.
* @param {Number} code The error code, if any, or 0 for success.
*/
sendAck(index: number, message: string, code: number): void;
/**
* 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 {String} data Base64-encoded data to write to the file.
*/
sendBlob(index: number, data: string): void;
/**
* Marks a currently-open stream as complete. The other end of the
* Guacamole connection will be notified via an "end" instruction that the
* stream is closed, and the index will be made available for reuse in
* future streams.
*
* @param {Number} index
* The index of the stream to end.
*/
endStream(index: number): void;
/**
* Fired whenever the state of this Guacamole.Client changes.
*
* @event
* @param {Number} state The new state of the client.
*/
onstatechange(state: number): void;
/**
* Fired when the remote client sends a name update.
*
* @event
* @param {String} name The new name of this client.
*/
onname(name: string): void;
/**
* Fired when an error is reported by the remote client, and the connection
* is being closed.
*
* @event
* @param {Guacamole.Status} status A status object which describes the
* error.
*/
onerror(status: Status): void;
/**
* Fired when a audio stream is created. The stream provided to this event
* handler will contain its own event handlers for received data.
*
* @event
* @param {Guacamole.InputStream} stream
* The stream that will receive audio data from the server.
*
* @param {String} mimetype
* The mimetype of the audio data which will be received.
*
* @return {Guacamole.AudioPlayer}
* An object which implements the Guacamole.AudioPlayer interface and
* has been initialized to play the data in the provided stream, or null
* if the built-in audio players of the Guacamole client should be
* used.
*/
onaudio(stream: InputStream, mimetype: string): AudioPlayer;
/**
* Fired when a video stream is created. The stream provided to this event
* handler will contain its own event handlers for received data.
*
* @event
* @param {Guacamole.InputStream} stream
* The stream that will receive video data from the server.
*
* @param {Guacamole.Display.VisibleLayer} layer
* The destination layer on which the received video data should be
* played. It is the responsibility of the Guacamole.VideoPlayer
* implementation to play the received data within this layer.
*
* @param {String} mimetype
* The mimetype of the video data which will be received.
*
* @return {Guacamole.VideoPlayer}
* An object which implements the Guacamole.VideoPlayer interface and
* has been initialied to play the data in the provided stream, or null
* if the built-in video players of the Guacamole client should be
* used.
*/
onvideo(stream: InputStream, layer: Display.VisibleLayer, mimetype: string): VideoPlayer;
/**
* Fired when the clipboard of the remote client is changing.
*
* @event
* @param {Guacamole.InputStream} stream The stream that will receive
* clipboard data from the server.
* @param {String} mimetype The mimetype of the data which will be received.
*/
onclipboard(stream: InputStream, mimetype: string): void;
/**
* Fired when a file stream is created. The stream provided to this event
* handler will contain its own event handlers for received data.
*
* @event
* @param {Guacamole.InputStream} stream 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.
*/
onfile(stream: InputStream, mimetype: string, filename: string): void;
/**
* Fired when a filesystem object is created. The object provided to this
* event handler will contain its own event handlers and functions for
* requesting and handling data.
*
* @event
* @param {Guacamole.Object} object
* The created filesystem object.
*
* @param {String} name
* The name of the filesystem.
*/
onfilesystem(object: Object, name: string): void;
/**
* Fired when a pipe stream is created. The stream provided to this event
* handler will contain its own event handlers for received data;
*
* @event
* @param {Guacamole.InputStream} stream 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.
*/
onpipe(stream: InputStream, mimetype: string, name: string): void;
/**
* Fired whenever a sync instruction is received from the server, indicating
* that the server is finished processing any input from the client and
* has sent any results.
*
* @event
* @param {Number} timestamp The timestamp associated with the sync
* instruction.
*/
onsync(timestamp: number): void;
}
/**
* Core object providing abstract communication for Guacamole. This object
* is a null implementation whose functions do nothing. Guacamole applications
* should use {@link Guacamole.HTTPTunnel} instead, or implement their own tunnel based
* on this one.
*
* @constructor
* @see Guacamole.HTTPTunnel
*/
class Tunnel {
/**
* The current state of this tunnel.
*
* @type {Number}
*/
state: number;
/**
* The maximum amount of time to wait for data to be received, in
* milliseconds. If data is not received within this amount of time,
* the tunnel is closed with an error. The default value is 15000.
*
* @type {Number}
*/
receiveTimeout: number;
/**
* Connect to the tunnel with the given optional data. This data is
* typically used for authentication. The format of data accepted is
* up to the tunnel implementation.
*
* @param {String} data The data to send to the tunnel when connecting.
*/
connect(data: string): void;
/**
* Disconnect from the tunnel.
*/
disconnect(): void;
/**
* Fired whenever an error is encountered by the tunnel.
*
* @event
* @param {Guacamole.Status} status A status object which describes the
* error.
*/
onerror(error: Status): void;
/**
* Fired whenever the state of the tunnel changes.
*
* @event
* @param {Number} state The new state of the client.
*/
onstatechange(state: number): void;
/**
* Fired once for every complete Guacamole instruction received, in order.
*
* @event
* @param {String} opcode The Guacamole instruction opcode.
* @param {Array} parameters The parameters provided for the instruction,
* if any.
*/
oninstruction(opcode: string, parameters: any): void;
/**
* Send the given message through the tunnel to the service on the other
* side. All messages are guaranteed to be received in the order sent.
*
* @param {...*} elements
* The elements of the message to send to the service on the other side
* of the tunnel.
*/
sendMessage(elements: any): void;
/**
* Changes the stored numeric state of this tunnel, firing the onstatechange
* event if the new state is different and a handler has been defined.
*
* @private
* @param {Number} state
* The new state of this tunnel.
*/
setState(state: number): void;
}
/**
* Guacamole Tunnel implemented over WebSocket via XMLHttpRequest.
*/
class WebSocketTunnel extends Tunnel {
/**
* @param {String} tunnelURL The URL of the WebSocket tunneling service.
*/
constructor(tunnelURL: string);
}
/**
* Guacamole Tunnel which cycles between all specified tunnels until
* no tunnels are left. Another tunnel is used if an error occurs but
* no instructions have been received. If an instruction has been
* received, or no tunnels remain, the error is passed directly out
* through the onerror handler (if defined).
*/
class ChainedTunnel extends Tunnel {
/**
* @param {...*} tunnelChain
* The tunnels to use, in order of priority.
*/
constructor(tunnelChain: any);
}
/**
* Guacamole Tunnel implemented over HTTP via XMLHttpRequest.
*/
class HTTPTunnel extends Tunnel {
/**
* @param {String} tunnelURL
* The URL of the HTTP tunneling service.
*
* @param {Boolean} [crossDomain=false]
* Whether tunnel requests will be cross-domain, and thus must use CORS
* mechanisms and headers. By default, it is assumed that tunnel requests
* will be made to the same domain.
*
* @param {Object} [extraTunnelHeaders={}]
* 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
* be added.
*/
constructor(tunnelURL: string, crossDomain: boolean, extraTunnelHeaders: any);
}
/**
* Guacamole Tunnel which replays a Guacamole protocol dump from a static file
* received via HTTP. Instructions within the file are parsed and handled as
* quickly as possible, while the file is being downloaded.
*/
class StaticHTTPTunnel extends Tunnel {
/**
* @param {String} url
* The URL of a Guacamole protocol dump.
*
* @param {Boolean} [crossDomain=false]
* Whether tunnel requests will be cross-domain, and thus must use CORS
* mechanisms and headers. By default, it is assumed that tunnel requests
* will be made to the same domain.
*
* @param {Object} [extraTunnelHeaders={}]
* 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
* be added.
*/
constructor(url: string, crossDomain: boolean, extraTunnelHeaders: any);
}
/**
* Abstract audio player which accepts, queues and plays back arbitrary audio
* data. It is up to implementations of this class to provide some means of
* handling a provided Guacamole.InputStream. Data received along the provided
* stream is to be played back immediately.
*/
class AudioPlayer {
sync(): void;
/**
* Determines whether the given mimetype is supported by any built-in
* implementation of Guacamole.AudioPlayer, and thus will be properly handled
* by Guacamole.AudioPlayer.getInstance().
*
* @param {String} mimetype
* The mimetype to check.
*
* @returns {Boolean}
* true if the given mimetype is supported by any built-in
* Guacamole.AudioPlayer, false otherwise.
*/
static isSupportedType(mimetype: string): boolean;
/**
* Returns a list of all mimetypes supported by any built-in
* Guacamole.AudioPlayer, in rough order of priority. Beware that only the core
* mimetypes themselves will be listed. Any mimetype parameters, even required
* ones, will not be included in the list. For example, "audio/L8" is a
* supported raw audio mimetype that is supported, but it is invalid without
* additional parameters. Something like "audio/L8;rate=44100" would be valid,
* however (see https://tools.ietf.org/html/rfc4856).
*
* @returns {String[]}
* A list of all mimetypes supported by any built-in Guacamole.AudioPlayer,
* excluding any parameters.
*/
static getSupportedTypes(): string[];
/**
* Returns an instance of Guacamole.AudioPlayer providing support for the given
* audio format. If support for the given audio format is not available, null
* is returned.
*
* @param {Guacamole.InputStream} stream
* The Guacamole.InputStream to read audio data from.
*
* @param {String} mimetype
* The mimetype of the audio data in the provided stream.
*
* @return {Guacamole.AudioPlayer}
* A Guacamole.AudioPlayer instance supporting the given mimetype and
* reading from the given stream, or null if support for the given mimetype
* is absent.
*/
static getInstance(stream: InputStream, mimetype: string): AudioPlayer;
}
/**
* Implementation of Guacamole.AudioPlayer providing support for raw PCM format
* audio. This player relies only on the Web Audio API and does not require any
* browser-level support for its audio formats.
*/
class RawAudioPlayer extends AudioPlayer {
/**
* @augments Guacamole.AudioPlayer
* @param {Guacamole.InputStream} stream
* The Guacamole.InputStream to read audio data from.
*
* @param {String} mimetype
* 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/L16;rate=44100,channels=2".
*/
constructor(stream: InputStream, mimetype: string);
/** @override */
sync(): void;
/**
* Determines whether the given mimetype is supported by
* Guacamole.RawAudioPlayer.
*
* @param {String} mimetype
* The mimetype to check.
*
* @returns {Boolean}
* true if the given mimetype is supported by Guacamole.RawAudioPlayer,
* false otherwise.
*/
static isSupportedType(mimetype: string): boolean;
/**
* Returns a list of all mimetypes supported by Guacamole.RawAudioPlayer. Only
* the core mimetypes themselves will be listed. Any mimetype parameters, even
* required ones, will not be included in the list. For example, "audio/L8" is
* a raw audio mimetype that may be supported, but it is invalid without
* additional parameters. Something like "audio/L8;rate=44100" would be valid,
* however (see https://tools.ietf.org/html/rfc4856).
*
* @returns {String[]}
* A list of all mimetypes supported by Guacamole.RawAudioPlayer, excluding
* any parameters. If the necessary JavaScript APIs for playing raw audio
* are absent, this list will be empty.
*/
static getSupportedTypes(): string[];
}
/**
* Abstract audio recorder which streams arbitrary audio data to an underlying
* Guacamole.OutputStream. It is up to implementations of this class to provide
* some means of handling this Guacamole.OutputStream. Data produced by the
* recorder is to be sent along the provided stream immediately.
*/
class AudioRecorder {
/**
* Callback which is invoked when the audio recording process has stopped
* and the underlying Guacamole stream has been closed normally. Audio will
* only resume recording if a new Guacamole.AudioRecorder is started. This
* Guacamole.AudioRecorder instance MAY NOT be reused.
*
* @event
*/
onclose(): void;
/**
* Callback which is invoked when the audio recording process cannot
* continue due to an error, if it has started at all. The underlying
* Guacamole stream is automatically closed. Future attempts to record
* audio should not be made, and this Guacamole.AudioRecorder instance
* MAY NOT be reused.
*
* @event
*/
onerror(): void;
/**
* Determines whether the given mimetype is supported by any built-in
* implementation of Guacamole.AudioRecorder, and thus will be properly handled
* by Guacamole.AudioRecorder.getInstance().
*
* @param {String} mimetype
* The mimetype to check.
*
* @returns {Boolean}
* true if the given mimetype is supported by any built-in
* Guacamole.AudioRecorder, false otherwise.
*/
static isSupportedType(mimetype: string): boolean;
/**
* Returns a list of all mimetypes supported by any built-in
* Guacamole.AudioRecorder, in rough order of priority. Beware that only the
* core mimetypes themselves will be listed. Any mimetype parameters, even
* required ones, will not be included in the list. For example, "audio/L8" is
* a supported raw audio mimetype that is supported, but it is invalid without
* additional parameters. Something like "audio/L8;rate=44100" would be valid,
* however (see https://tools.ietf.org/html/rfc4856).
*
* @returns {String[]}
* A list of all mimetypes supported by any built-in
* Guacamole.AudioRecorder, excluding any parameters.
*/
static getSupportedTypes(): string[];
/**
* Returns an instance of Guacamole.AudioRecorder providing support for the
* given audio format. If support for the given audio format is not available,
* null is returned.
*
* @param {Guacamole.OutputStream} stream
* The Guacamole.OutputStream to send audio data through.
*
* @param {String} mimetype
* The mimetype of the audio data to be sent along the provided stream.
*
* @return {Guacamole.AudioRecorder}
* A Guacamole.AudioRecorder instance supporting the given mimetype and
* writing to the given stream, or null if support for the given mimetype
* is absent.
*/
static getInstance(stream: OutputStream, mimetype: string);
}
/**
* Implementation of Guacamole.AudioRecorder providing support for raw PCM
* format audio. This recorder relies only on the Web Audio API and does not
* require any browser-level support for its audio formats.
*
* @constructor
* @augments Guacamole.AudioRecorder
* @param {Guacamole.OutputStream} stream
* The Guacamole.OutputStream to write audio data to.
*
* @param {String} mimetype
* 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,
* such as: "audio/L16;rate=44100,channels=2".
*/
class RawAudioRecorder extends AudioRecorder {
/**
* @augments Guacamole.AudioRecorder
* @param {Guacamole.OutputStream} stream
* The Guacamole.OutputStream to write audio data to.
*
* @param {String} mimetype
* 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,
* such as: "audio/L16;rate=44100,channels=2".
*/
constructor(stream: AudioRecorder, mimetype: string);
/**
* Determines whether the given mimetype is supported by
* Guacamole.RawAudioRecorder.
*
* @param {String} mimetype
* The mimetype to check.
*
* @returns {Boolean}
* true if the given mimetype is supported by Guacamole.RawAudioRecorder,
* false otherwise.
*/
static isSupportedType(mimetype: string): boolean;
/**
* Returns a list of all mimetypes supported by Guacamole.RawAudioRecorder. Only
* the core mimetypes themselves will be listed. Any mimetype parameters, even
* required ones, will not be included in the list. For example, "audio/L8" is
* a raw audio mimetype that may be supported, but it is invalid without
* additional parameters. Something like "audio/L8;rate=44100" would be valid,
* however (see https://tools.ietf.org/html/rfc4856).
*
* @returns {String[]}
* A list of all mimetypes supported by Guacamole.RawAudioRecorder,
* excluding any parameters. If the necessary JavaScript APIs for recording
* raw audio are absent, this list will be empty.
*/
static getSupportedTypes(): string[];
}
/**
* Provides cross-browser and cross-keyboard keyboard for a specific element.
* Browser and keyboard layout variation is abstracted away, providing events
* which represent keys as their corresponding X11 keysym.
*/
class Keyboard {
/**
* @param {Element} element The Element to use to provide keyboard events.
*/
constructor(element: any);
/**
* Fired whenever the user presses a key with the element associated
* with this Guacamole.Keyboard in focus.
*
* @event
* @param {Number} keysym The keysym of the key being pressed.
* @return {Boolean} true if the key event should be allowed through to the
* browser, false otherwise.
*/
onkeydown(keysym: number): boolean;
/**
* Fired whenever the user releases a key with the element associated
* with this Guacamole.Keyboard in focus.
*
* @event
* @param {Number} keysym The keysym of the key being released.
*/
onkeyup(keysym: number): void;
/**
* Marks a key as pressed, firing the keydown event if registered. Key
* repeat for the pressed key will start after a delay if that key is
* not a modifier. The return value of this function depends on the
* return value of the keydown event handler, if any.
*
* @param {Number} keysym The keysym of the key to press.
* @return {Boolean} true if event should NOT be canceled, false otherwise.
*/
press(keysym: number): boolean;
/**
* Marks a key as released, firing the keyup event if registered.
*
* @param {Number} keysym The keysym of the key to release.
*/
release(keysym: number): void;
/**
* Resets the state of this keyboard, releasing all keys, and firing keyup
* events for each released key.
*/
reset(): void;
}
/**
* The Guacamole display. The display does not deal with the Guacamole
* protocol, and instead implements a set of graphical operations which
* embody the set of operations present in the protocol. The order operations
* are executed is guaranteed to be in the same order as their corresponding
* functions are called.
*/
class Display {
/**
* The X coordinate of the hotspot of the mouse cursor. The hotspot is
* the relative location within the image of the mouse cursor at which
* each click occurs.
*
* @type {Number}
*/
cursorHotspotX: number;
/**
* The Y coordinate of the hotspot of the mouse cursor. The hotspot is
* the relative location within the image of the mouse cursor at which
* each click occurs.
*
* @type {Number}
*/
cursorHotspotY: number;
/**
* The current X coordinate of the local mouse cursor. This is not
* necessarily the location of the actual mouse - it refers only to
* the location of the cursor image within the Guacamole display, as
* last set by moveCursor().
*
* @type {Number}
*/
cursorX: number;
/**
* The current X coordinate of the local mouse cursor. This is not
* necessarily the location of the actual mouse - it refers only to
* the location of the cursor image within the Guacamole display, as
* last set by moveCursor().
*
* @type {Number}
*/
cursorY: number;
/**
* Fired when the default layer (and thus the entire Guacamole display)
* is resized.
*
* @event
* @param {Number} width The new width of the Guacamole display.
* @param {Number} height The new height of the Guacamole display.
*/
onresize(width: number, height: number): void;
/**
* Fired whenever the local cursor image is changed. This can be used to
* implement special handling of the client-side cursor, or to override
* the default use of a software cursor layer.
*
* @event
* @param {HTMLCanvasElement} canvas The cursor image.
* @param {Number} x The X-coordinate of the cursor hotspot.
* @param {Number} y The Y-coordinate of the cursor hotspot.
*/
oncursor(canvas: any, x: number, y: number): void;
/**
* Returns the element which contains the Guacamole display.
*
* @return {Element} The element containing the Guacamole display.
*/
getElement(): any;
/**
* Returns the width of this display.
*
* @return {Number} The width of this display;
*/
getWidth(): number;
/**
* Returns the height of this display.
*
* @return {Number} The height of this display;
*/
getHeight(): number;
/**
* Returns the default layer of this display. Each Guacamole display always
* has at least one layer. Other layers can optionally be created within
* this layer, but the default layer cannot be removed and is the absolute
* ancestor of all other layers.
*
* @return {Guacamole.Display.VisibleLayer} The default layer.
*/
getDefaultLayer(): Display.VisibleLayer;
/**
* Returns the cursor layer of this display. Each Guacamole display contains
* a layer for the image of the mouse cursor. This layer is a special case
* and exists above all other layers, similar to the hardware mouse cursor.
*
* @return {Guacamole.Display.VisibleLayer} The cursor layer.
*/
getCursorLayer(): Display.VisibleLayer;
/**
* Creates a new layer. The new layer will be a direct child of the default
* layer, but can be moved to be a child of any other layer. Layers returned
* by this function are visible.
*
* @return {Guacamole.Display.VisibleLayer} The newly-created layer.
*/
createLayer(): Display.VisibleLayer;
/**
* Creates a new buffer. Buffers are invisible, off-screen surfaces. They
* are implemented in the same manner as layers, but do not provide the
* same nesting semantics.
*
* @return {Guacamole.Layer} The newly-created buffer.
*/
createBuffer(): Layer;
/**
* Flush all pending draw tasks, if possible, as a new frame. If the entire
* frame is not ready, the flush will wait until all required tasks are
* unblocked.
*
* @param {function} callback The function to call when this frame is
* flushed. This may happen immediately, or
* later when blocked tasks become unblocked.
*/
flush(callback: any): void;
/**
* Sets the hotspot and image of the mouse cursor displayed within the
* Guacamole display.
*
* @param {Number} hotspotX The X coordinate of the cursor hotspot.
* @param {Number} hotspotY The Y coordinate of the cursor hotspot.
* @param {Guacamole.Layer} layer The source layer containing the data which
* should be used as the mouse cursor image.
* @param {Number} srcx The X coordinate of the upper-left corner of the
* rectangle within the source layer's coordinate
* space to copy data from.
* @param {Number} srcy The Y coordinate of the upper-left corner of the
* rectangle within the source layer's coordinate
* space to copy data from.
* @param {Number} srcw 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.
*/
setCursor(hotspotX: number, hotspotY: number, layer: Layer, srcx: number, srcy: number, srcw: number, srch: number): void;
/**
* Sets whether the software-rendered cursor is shown. This cursor differs
* from the hardware cursor in that it is built into the Guacamole.Display,
* and relies on its own Guacamole layer to render.
*
* @param {Boolean} [shown=true] Whether to show the software cursor.
*/
showCursor(shown: boolean): void;
/**
* Sets the location of the local cursor to the given coordinates. For the
* sake of responsiveness, this function performs its action immediately.
* Cursor motion is not maintained within atomic frames.
*
* @param {Number} x The X coordinate to move the cursor to.
* @param {Number} y The Y coordinate to move the cursor to.
*/
moveCursor(x: number, y: number): void;
/**
* Changes the size of the given Layer to the given width and height.
* Resizing is only attempted if the new size provided is actually different
* from the current size.
*
* @param {Guacamole.Layer} layer The layer to resize.
* @param {Number} width The new width.
* @param {Number} height The new height.
*/
resize(layer: Layer, width: number, height: number): void;
/**
* Draws the specified image at the given coordinates. The image specified
* must already be loaded.
*
* @param {Guacamole.Layer} layer The layer to draw upon.
* @param {Number} x The destination X coordinate.
* @param {Number} y The destination Y coordinate.
* @param {Image} image The image to draw. Note that this is an Image
* object - not a URL.
*/
drawImage(layer: Layer, x: number, y: number, image: any): void;
/**
* Draws the image contained within the specified Blob at the given
* coordinates. The Blob specified must already be populated with image
* data.
*
* @param {Guacamole.Layer} layer
* The layer to draw upon.
*
* @param {Number} x
* The destination X coordinate.
*
* @param {Number} y
* The destination Y coordinate.
*
* @param {Blob} blob
* The Blob containing the image data to draw.
*/
drawBlob(layer: Layer, x: number, y: number, blob: any): void;
/**
* Draws the image at the specified URL at the given coordinates. The image
* will be loaded automatically, and this and any future operations will
* wait for the image to finish loading.
*
* @param {Guacamole.Layer} layer The layer to draw upon.
* @param {Number} x The destination X coordinate.
* @param {Number} y The destination Y coordinate.
* @param {String} url The URL of the image to draw.
*/
draw(layer: Layer, x: number, y: number, url: string): void;
/**
* Plays the video at the specified URL within this layer. The video
* will be loaded automatically, and this and any future operations will
* wait for the video to finish loading. Future operations will not be
* executed until the video finishes playing.
*
* @param {Guacamole.Layer} layer The layer to draw upon.
* @param {String} mimetype The mimetype of the video to play.
* @param {Number} duration The duration of the video in milliseconds.
* @param {String} url The URL of the video to play.
*/
play(layer: Layer, mimetype: string, duration: number, url: string): void;
/**
* Transfer a rectangle of image data from one Layer to this Layer using the
* specified transfer function.
*
* @param {Guacamole.Layer} srcLayer The Layer to copy image data from.
* @param {Number} srcx The X coordinate of the upper-left corner of the
* rectangle within the source Layer's coordinate
* space to copy data from.
* @param {Number} srcy The Y coordinate of the upper-left corner of the
* rectangle within the source Layer's coordinate
* space to copy data from.
* @param {Number} srcw 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 {Guacamole.Layer} dstLayer The layer to draw upon.
* @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.
*/
transfer(srcLayer: Layer, srcx: number, srcy: number, srcw: number, srch: number, dstLayer: Layer, x: number, y: number, transferFunction: any): void;
/**
* Put a rectangle of image data from one Layer to this Layer directly
* without performing any alpha blending. Simply copy the data.
*
* @param {Guacamole.Layer} srcLayer The Layer to copy image data from.
* @param {Number} srcx The X coordinate of the upper-left corner of the
* rectangle within the source Layer's coordinate
* space to copy data from.
* @param {Number} srcy The Y coordinate of the upper-left corner of the
* rectangle within the source Layer's coordinate
* space to copy data from.
* @param {Number} srcw 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 {Guacamole.Layer} dstLayer The layer to draw upon.
* @param {Number} x The destination X coordinate.
* @param {Number} y The destination Y coordinate.
*/
put(srcLayer: Layer, srcx: number, srcy: number, srcw: number, srch: number, dstLayer: Layer, x: number, y: number): void;
/**
* Copy a rectangle of image data from one Layer to this Layer. This
* operation will copy exactly the image data that will be drawn once all
* operations of the source Layer that were pending at the time this
* 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.
*
* @param {Guacamole.Layer} srcLayer The Layer to copy image data from.
* @param {Number} srcx The X coordinate of the upper-left corner of the
* rectangle within the source Layer's coordinate
* space to copy data from.
* @param {Number} srcy The Y coordinate of the upper-left corner of the
* rectangle within the source Layer's coordinate
* space to copy data from.
* @param {Number} srcw 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 {Guacamole.Layer} dstLayer The layer to draw upon.
* @param {Number} x The destination X coordinate.
* @param {Number} y The destination Y coordinate.
*/
copy(srcLayer: Layer, srcx: number, srcy: number, srcw: number, srch: number, dstLayer: Layer, x: number, y: number): void;
/**
* Starts a new path at the specified point.
*
* @param {Guacamole.Layer} layer The layer to draw upon.
* @param {Number} x The X coordinate of the point to draw.
* @param {Number} y The Y coordinate of the point to draw.
*/
moveTo(layer: Layer, x: number, y: number): void;
/**
* Add the specified line to the current path.
*
* @param {Guacamole.Layer} layer The layer to draw upon.
* @param {Number} x 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.
*/
lineTo(layer: Layer, x: number, y: number): void;
/**
* Add the specified arc to the current path.
*
* @param {Guacamole.Layer} layer The layer to draw upon.
* @param {Number} x The X coordinate of the center of the circle which
* will contain the arc.
* @param {Number} y The Y coordinate of the center of the circle which
* will contain the arc.
* @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.
*/
arc(layer: Layer, x: number, y: number, radius: number, startAngle: number, endAngle: number, negative: boolean): void;
/**
* Starts a new path at the specified point.
*
* @param {Guacamole.Layer} layer The layer to draw upon.
* @param {Number} cp1x The X coordinate of the first control point.
* @param {Number} cp1y The Y 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} x The X coordinate of the endpoint of the curve.
* @param {Number} y The Y coordinate of the endpoint