Skip to content
This repository has been archived by the owner on Nov 4, 2023. It is now read-only.

Commit

Permalink
fix(popup): popup timeout now accessible to user on $scope (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
akloeckner authored Nov 22, 2020
1 parent 250ac64 commit 6e73deb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions scripts/controllers/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ App.controller('Main', function ($scope, $timeout, $location, Api) {

$scope.activeCamera = null;
$scope.activePopup = null;
$scope.popupTimeout = null;

$scope.alarmCode = null;
$scope.activeAlarm = null;
Expand All @@ -40,7 +41,6 @@ App.controller('Main', function ($scope, $timeout, $location, Api) {
let showedPages = [];

const latestAlarmActions = {};
let popupTimeout = null;
let bodyClass = null;
const mainStyles = {};
let activePage = null;
Expand Down Expand Up @@ -1396,8 +1396,9 @@ App.controller('Main', function ($scope, $timeout, $location, Api) {
};

$scope.openPopup = function (item, entity, layout) {
if (popupTimeout) {
clearTimeout(popupTimeout);
if ($scope.popupTimeout) {
clearTimeout($scope.popupTimeout);
$scope.popupTimeout = null;
}
$scope.activePopup = {
item: item,
Expand All @@ -1407,8 +1408,9 @@ App.controller('Main', function ($scope, $timeout, $location, Api) {
};

$scope.closePopup = function () {
if (popupTimeout) {
clearTimeout(popupTimeout);
if ($scope.popupTimeout) {
clearTimeout($scope.popupTimeout);
$scope.popupTimeout = null;
}
$scope.activePopup = null;
};
Expand Down Expand Up @@ -1629,7 +1631,7 @@ App.controller('Main', function ($scope, $timeout, $location, Api) {
$scope.openPopup(item, entity, layout);

if (CONFIG.doorEntryTimeout) {
popupTimeout = $timeout(function () {
$scope.popupTimeout = $timeout(function () {
$scope.closePopup();
}, CONFIG.doorEntryTimeout * 1000);
}
Expand Down

0 comments on commit 6e73deb

Please sign in to comment.