jmuehlner commented on code in PR #922:
URL: https://github.com/apache/guacamole-client/pull/922#discussion_r1370665187


##########
guacamole/src/main/frontend/src/app/player/directives/player.js:
##########
@@ -401,6 +427,43 @@ angular.module('player').directive('guacPlayer', 
['$injector', function guacPlay
         $scope.$on('$destroy', function playerDestroyed() {
             $scope.recording.pause();
             $scope.recording.abort();
+            mouseActivityTimer !== null && 
$window.clearTimeout(mouseActivityTimer);
+        });
+
+        /**
+         * Clean up the mouse movement class after no mouse activity has been
+         * detected for the appropriate time period.
+         */
+        const scheduleCleanupTimeout = _.debounce(() =>
+            mouseActivityTimer = $window.setTimeout(() => {
+                mouseActivityTimer = null;
+                $element.removeClass('recent-mouse-movement');
+            }, MOUSE_CLEANUP_TIMER_DELAY),
+
+            /*
+             * Only schedule the cleanup task after the mouse hasn't moved
+             * for a reasonable amount of time to ensure that the number of
+             * created cleanup timers remains reasonable.
+             */
+            MOUSE_DEBOUNCE_DELAY);

Review Comment:
   Yeah, there will be at most once, I was referring more to the number of 
timers that are scheduled while the mouse is moving. I don't want to be 
constantly cancelling and rescheduling new timers on every mouse movement. In 
practice it doesn't seem to cause excessive CPU / memory usage or anything, 
just seems wasteful.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to