diff --git a/services/web/frontend/js/ide.js b/services/web/frontend/js/ide.js index 549b65a1de..65270746d8 100644 --- a/services/web/frontend/js/ide.js +++ b/services/web/frontend/js/ide.js @@ -80,7 +80,8 @@ App.controller( eventTracking, metadata, $q, - CobrandingDataService + CobrandingDataService, + $window ) { // Don't freak out if we're already in an apply callback let err, pdfLayout, userAgent @@ -256,8 +257,22 @@ If the project has been renamed please look in your project list for a new proje return (_loaded = true) }) - $scope.$on('cursor:editor:update', eventTracking.editingSessionHeartbeat) - $scope.$on('scroll:editor:update', eventTracking.editingSessionHeartbeat) + ide.editingSessionHeartbeat = () => { + eventTracking.editingSessionHeartbeat() + } + + $scope.$on('cursor:editor:update', () => { + ide.editingSessionHeartbeat() + }) + $scope.$on('scroll:editor:update', () => { + ide.editingSessionHeartbeat() + }) + + angular.element($window).on('click', ide.editingSessionHeartbeat) + + $scope.$on('$destroy', () => + angular.element($window).off('click', ide.editingSessionHeartbeat) + ) const DARK_THEMES = [ 'ambiance', diff --git a/services/web/frontend/js/ide/editor/directives/aceEditor.js b/services/web/frontend/js/ide/editor/directives/aceEditor.js index 017eb7eb8a..3e98b4138f 100644 --- a/services/web/frontend/js/ide/editor/directives/aceEditor.js +++ b/services/web/frontend/js/ide/editor/directives/aceEditor.js @@ -818,16 +818,6 @@ App.directive( // deletes and then inserts document content session.setAnnotations(scope.annotations) - angular - .element($window) - .on('click', eventTracking.editingSessionHeartbeat) - - scope.$on('$destroy', () => - angular - .element($window) - .off('click', eventTracking.editingSessionHeartbeat) - ) - if (scope.eventsBridge != null) { session.on('changeScrollTop', onScroll) } diff --git a/services/web/frontend/js/main/event.js b/services/web/frontend/js/main/event.js index 160fecde0c..fcf2248bd7 100644 --- a/services/web/frontend/js/main/event.js +++ b/services/web/frontend/js/main/event.js @@ -70,10 +70,12 @@ App.factory('eventTracking', function ($http, localStorage) { }, editingSessionHeartbeat() { + sl_console.log('[Event] heartbeat trigger') if (!(nextHeartbeat <= new Date())) { return } + sl_console.log('[Event] send heartbeat request') _sendEditingSessionHeartbeat() heartbeatsSent++