mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-462: Allow pending display frames to be cancelled.
This commit is contained in:
@@ -201,6 +201,22 @@ Guacamole.Display = function() {
|
|||||||
*/
|
*/
|
||||||
function Frame(callback, tasks) {
|
function Frame(callback, tasks) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancels rendering of this frame and all associated tasks. The
|
||||||
|
* callback provided at construction time, if any, is not invoked.
|
||||||
|
*/
|
||||||
|
this.cancel = function cancel() {
|
||||||
|
|
||||||
|
callback = null;
|
||||||
|
|
||||||
|
tasks.forEach(function cancelTask(task) {
|
||||||
|
task.cancel();
|
||||||
|
});
|
||||||
|
|
||||||
|
tasks = [];
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this frame is ready to be rendered. This function
|
* Returns whether this frame is ready to be rendered. This function
|
||||||
* returns true if and only if ALL underlying tasks are unblocked.
|
* returns true if and only if ALL underlying tasks are unblocked.
|
||||||
@@ -271,6 +287,16 @@ Guacamole.Display = function() {
|
|||||||
*/
|
*/
|
||||||
this.blocked = blocked;
|
this.blocked = blocked;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancels this task such that it will not run. The task handler
|
||||||
|
* provided at construction time, if any, is not invoked. Calling
|
||||||
|
* execute() after calling this function has no effect.
|
||||||
|
*/
|
||||||
|
this.cancel = function cancel() {
|
||||||
|
task.blocked = false;
|
||||||
|
taskHandler = null;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unblocks this Task, allowing it to run.
|
* Unblocks this Task, allowing it to run.
|
||||||
*/
|
*/
|
||||||
@@ -417,6 +443,27 @@ Guacamole.Display = function() {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancels rendering of all pending frames and associated rendering
|
||||||
|
* operations. The callbacks provided to outstanding past calls to flush(),
|
||||||
|
* if any, are not invoked.
|
||||||
|
*/
|
||||||
|
this.cancel = function cancel() {
|
||||||
|
|
||||||
|
frames.forEach(function cancelFrame(frame) {
|
||||||
|
frame.cancel();
|
||||||
|
});
|
||||||
|
|
||||||
|
frames = [];
|
||||||
|
|
||||||
|
tasks.forEach(function cancelTask(task) {
|
||||||
|
task.cancel();
|
||||||
|
});
|
||||||
|
|
||||||
|
tasks = [];
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the hotspot and image of the mouse cursor displayed within the
|
* Sets the hotspot and image of the mouse cursor displayed within the
|
||||||
* Guacamole display.
|
* Guacamole display.
|
||||||
|
Reference in New Issue
Block a user