GuacLite
view release on metacpan or search on metacpan
share/public/guaclite.js view on Meta::CPAN
this.moveTo = function(layer, x, y) {
scheduleTask(function __display_moveTo() {
layer.moveTo(x, y);
});
};
/**
* 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.
*/
this.lineTo = function(layer, x, y) {
scheduleTask(function __display_lineTo() {
layer.lineTo(x, y);
});
};
/**
* Add the specified arc to the current path.
*
share/public/guaclite.js view on Meta::CPAN
};
/**
* 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 of the curve.
*/
this.curveTo = function(layer, cp1x, cp1y, cp2x, cp2y, x, y) {
scheduleTask(function __display_curveTo() {
layer.curveTo(cp1x, cp1y, cp2x, cp2y, x, y);
});
};
/**
* Closes the current path by connecting the end point with the start
* point (if any) with a straight line.
share/public/guaclite.js view on Meta::CPAN
}
if (layer.autosize) fitRect(x, y, 0, 0);
context.moveTo(x, y);
};
/**
* Add the specified line to the current path.
*
* @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.
*/
this.lineTo = function(x, y) {
// Start a new path if current path is closed
if (pathClosed) {
context.beginPath();
pathClosed = false;
}
if (layer.autosize) fitRect(x, y, 0, 0);
share/public/guaclite.js view on Meta::CPAN
};
/**
* Starts a new path at the specified point.
*
* @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 of the curve.
*/
this.curveTo = function(cp1x, cp1y, cp2x, cp2y, x, y) {
// Start a new path if current path is closed
if (pathClosed) {
context.beginPath();
pathClosed = false;
}
if (layer.autosize) fitRect(x, y, 0, 0);
share/public/guaclite.js view on Meta::CPAN
}
reset_timeout();
// Get UUID from response
tunnel.setUUID(connect_xmlhttprequest.responseText);
// Mark as open
tunnel.setState(Guacamole.Tunnel.State.OPEN);
// Ping tunnel endpoint regularly to test connection stability
pingInterval = setInterval(function sendPing() {
tunnel.sendMessage("nop");
}, PING_FREQUENCY);
// Start reading data
handleResponse(makeRequest());
};
connect_xmlhttprequest.open("POST", TUNNEL_CONNECT, true);
share/public/guaclite.js view on Meta::CPAN
// Mark the tunnel as connecting
tunnel.setState(Guacamole.Tunnel.State.CONNECTING);
// Connect socket
socket = new WebSocket(tunnelURL + "?" + data, "guacamole");
socket.onopen = function(event) {
reset_timeout();
// Ping tunnel endpoint regularly to test connection stability
pingInterval = setInterval(function sendPing() {
tunnel.sendMessage(Guacamole.Tunnel.INTERNAL_DATA_OPCODE,
"ping", new Date().getTime());
}, PING_FREQUENCY);
};
socket.onclose = function(event) {
// Pull status code directly from closure reason provided by Guacamole
( run in 0.456 second using v1.01-cache-2.11-cpan-beeb90c9504 )