From e5cc1c5826f65b5d40892cd92714cc9f070198a9 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Sun, 8 Apr 2018 20:29:20 -0400 Subject: broadcast handler cleanups and others --- www/js/PortalLoginCtrl.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'www/js/PortalLoginCtrl.js') diff --git a/www/js/PortalLoginCtrl.js b/www/js/PortalLoginCtrl.js index 4161c5b9..9971de86 100644 --- a/www/js/PortalLoginCtrl.js +++ b/www/js/PortalLoginCtrl.js @@ -7,12 +7,21 @@ angular.module('zmApp.controllers').controller('zmApp.PortalLoginCtrl', ['$ionic { var processPush = false; + var broadcastHandles = []; $scope.$on ('$ionicView.beforeEnter', function() { //processPush = false; // NVRDataModel.debug ("BeforeEnter in Portal: setting ProcessPush to false"); }); + $scope.$on ('$ionicView.beforeLeave', function() { + NVRDataModel.debug ("Deregistering broadcast handles"); + for (var i=0; i < broadcastHandles.length; i++) { + broadcastHandles[i](); + } + broadcastHandles = []; + }); + $scope.$on('$ionicView.enter', function() { @@ -276,13 +285,14 @@ angular.module('zmApp.controllers').controller('zmApp.PortalLoginCtrl', ['$ionic } - $rootScope.$on("process-push", function () { + var pp = $rootScope.$on("process-push", function () { NVRDataModel.debug("*** PROCESS PUSH HANDLER CALLED INSIDE PORTAL LOGIN, setting ProcessPush to true"); processPush = true; evaluateTappedNotification(); }); + broadcastHandles.push(pp); function evaluateTappedNotification() { -- cgit v1.2.3