Clear the timer that watches build status when the page is changed
This commit is contained in:
parent
c91b40f356
commit
da71aa7254
1 changed files with 9 additions and 1 deletions
|
@ -336,13 +336,21 @@ function RepoCtrl($scope, Restangular, $routeParams, $rootScope, $location, $tim
|
||||||
});
|
});
|
||||||
|
|
||||||
var startBuildInfoTimer = function(repo) {
|
var startBuildInfoTimer = function(repo) {
|
||||||
|
if ($scope.interval) { return; }
|
||||||
|
|
||||||
getBuildInfo(repo);
|
getBuildInfo(repo);
|
||||||
setInterval(function() {
|
$scope.interval = setInterval(function() {
|
||||||
var container = document.getElementById('build-status-container');
|
var container = document.getElementById('build-status-container');
|
||||||
if (container != null && container.offsetWidth > 0) {
|
if (container != null && container.offsetWidth > 0) {
|
||||||
$scope.$apply(function() { getBuildInfo(repo); });
|
$scope.$apply(function() { getBuildInfo(repo); });
|
||||||
}
|
}
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
||||||
|
$scope.$on("$destroy", function() {
|
||||||
|
if ($scope.interval) {
|
||||||
|
clearInterval($scope.interval);
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var getBuildInfo = function(repo) {
|
var getBuildInfo = function(repo) {
|
||||||
|
|
Reference in a new issue