From 7e18061e53b992ca15c3f166761a7b25851bcd8c Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Fri, 2 Dec 2016 14:16:47 +0100 Subject: [PATCH] Fixing the clock --- openslides/core/static/js/core/projector.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/openslides/core/static/js/core/projector.js b/openslides/core/static/js/core/projector.js index c2e2583cc..50f58d990 100644 --- a/openslides/core/static/js/core/projector.js +++ b/openslides/core/static/js/core/projector.js @@ -203,11 +203,21 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core']) .controller('SlideClockCtrl', [ '$scope', - function($scope) { + '$interval', + function($scope, $interval) { // Attention! Each object that is used here has to be dealt on server side. // Add it to the coresponding get_requirements method of the ProjectorElement // class. $scope.servertime = ( Date.now() / 1000 - $scope.serverOffset ) * 1000; + var interval = $interval(function () { + $scope.servertime = ( Date.now() / 1000 - $scope.serverOffset ) * 1000; + }, 30000); // Update the clock every 30 seconds + + $scope.$on('$destroy', function() { + if (interval) { + $interval.cancel(interval); + } + }); } ])