summaryrefslogtreecommitdiff
path: root/www/js/EventCtrl.js
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2018-04-08 20:29:20 -0400
committerPliable Pixels <pliablepixels@gmail.com>2018-04-08 20:29:20 -0400
commite5cc1c5826f65b5d40892cd92714cc9f070198a9 (patch)
tree8384bbb90d81808e0dca96bee889dd38eb158b43 /www/js/EventCtrl.js
parenta9273df91eced721b23f311e37b8d820f5951ada (diff)
broadcast handler cleanups and others
Diffstat (limited to 'www/js/EventCtrl.js')
-rw-r--r--www/js/EventCtrl.js24
1 files changed, 22 insertions, 2 deletions
diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js
index 90eb90bf..b39921fd 100644
--- a/www/js/EventCtrl.js
+++ b/www/js/EventCtrl.js
@@ -61,6 +61,7 @@ angular.module('zmApp.controllers')
var mycarouselWatcher;
var nolangFrom;
var nolangTo;
+ var broadcastHandles = [];
$scope.typeOfFrames = $translate.instant('kShowTimeDiffFrames');
$scope.outlineMotion = false;
@@ -76,17 +77,19 @@ angular.module('zmApp.controllers')
//---------------------------------------------------
//we come here is TZ is updated after the view loads
- $rootScope.$on('tz-updated', function()
+ var tzu = $rootScope.$on('tz-updated', function()
{
$scope.tzAbbr = NVRDataModel.getTimeZoneNow();
NVRDataModel.debug("Timezone API updated timezone to " + NVRDataModel.getTimeZoneNow());
});
+ broadcastHandles.push(tzu);
- $rootScope.$on("language-changed", function()
+ var lc = $rootScope.$on("language-changed", function()
{
NVRDataModel.log(">>>>>>>>>>>>>>> language changed");
doRefresh();
});
+ broadcastHandles.push(lc);
$scope.$on('$ionicView.afterEnter', function()
{
@@ -151,6 +154,17 @@ angular.module('zmApp.controllers')
}
+
+ $scope.$on('$ionicView.beforeLeave', function()
+ {
+
+ NVRDataModel.debug ("Deregistering broadcast handles");
+ for (var i=0; i < broadcastHandles.length; i++) {
+ broadcastHandles[i]();
+ }
+ broadcastHandles = [];
+ });
+
$scope.$on('$ionicView.beforeEnter', function()
{
@@ -2138,6 +2152,12 @@ angular.module('zmApp.controllers')
{
NVRDataModel.debug("EventCtrl:onpause called");
if ($scope.popover) $scope.popover.remove();
+ NVRDataModel.debug ("Deregistering broadcast handles");
+ for (var i=0; i < broadcastHandles.length; i++) {
+ broadcastHandles[i]();
+ }
+ broadcastHandles = [];
+
}
//-------------------------------------------------------------------------