From 058665e1f5d9affb8e21b0376646c91884c9e967 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 28 Jun 2016 16:10:03 -0700 Subject: [PATCH] GUACAMOLE-55: Define wait period before clipboard reads with a documented constant. --- .../app/clipboard/services/clipboardService.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/guacamole/src/main/webapp/app/clipboard/services/clipboardService.js b/guacamole/src/main/webapp/app/clipboard/services/clipboardService.js index d15781672..94c31c3d6 100644 --- a/guacamole/src/main/webapp/app/clipboard/services/clipboardService.js +++ b/guacamole/src/main/webapp/app/clipboard/services/clipboardService.js @@ -32,6 +32,18 @@ angular.module('clipboard').factory('clipboardService', ['$injector', var service = {}; + /** + * The amount of time to wait before actually serving a request to read + * clipboard data, in milliseconds. Providing a reasonable delay between + * request and read attempt allows the cut/copy operation to settle, in + * case the data we are anticipating to be present is not actually present + * in the clipboard yet. + * + * @constant + * @type Number + */ + var CLIPBOARD_READ_DELAY = 100; + /** * Reference to the window.document object. * @@ -399,7 +411,7 @@ angular.module('clipboard').factory('clipboardService', ['$injector', originalElement.focus(); popSelection(); - }, 100); + }, CLIPBOARD_READ_DELAY); return deferred.promise; };