From 0bab2b6a2d06ded4ecc10e2fc03f95f69e96fa65 Mon Sep 17 00:00:00 2001 From: pliablepixels Date: Tue, 26 Jan 2016 17:41:03 -0500 Subject: #155 - trapping 'beforeLeave' so we have enough time to apply window.stop Former-commit-id: 6f3a8dada384f770d5b2c6efc089fb06406cef54 --- www/js/ModalCtrl.js | 14 ++++++++++++++ www/js/MontageCtrl.js | 13 +++++++++++++ www/js/MontageHistoryCtrl.js | 8 +++++--- 3 files changed, 32 insertions(+), 3 deletions(-) (limited to 'www') diff --git a/www/js/ModalCtrl.js b/www/js/ModalCtrl.js index 9ad43a9d..b0fe9eaf 100644 --- a/www/js/ModalCtrl.js +++ b/www/js/ModalCtrl.js @@ -847,6 +847,20 @@ angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootSco $scope.isModalActive = false; $interval.cancel(intervalModalHandle); }); + + + $scope.$on('$ionicView.beforeLeave', function () { + console.log("**VIEW ** ModalCtrl left"); + + + ZMDataModel.zmLog ("Stopping network pull..."); + // make sure this is applied in scope digest to stop network pull + // thats why we are doing it beforeLeave + + window.stop(); + /* + + }); $scope.$on('$ionicView.unloaded', function () { $scope.isModalActive = false; diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index 3631ad20..2e64d3e5 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -843,6 +843,19 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', ' console.log("**VIEW ** Montage Ctrl Left, force removing modal"); if ($scope.modal) $scope.modal.remove(); }); + + + $scope.$on('$ionicView.beforeLeave', function () { + console.log("**VIEW ** Montage Ctrl Left, force removing modal"); + + + ZMDataModel.zmLog ("Stopping network pull..."); + // make sure this is applied in scope digest to stop network pull + // thats why we are doing it beforeLeave + + window.stop(); + + }); $scope.$on('$ionicView.unloaded', function () { // console.log("**************** CLOSING WINDOW ***************************"); diff --git a/www/js/MontageHistoryCtrl.js b/www/js/MontageHistoryCtrl.js index 3c2ea33c..ddd667e6 100644 --- a/www/js/MontageHistoryCtrl.js +++ b/www/js/MontageHistoryCtrl.js @@ -1147,8 +1147,10 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc ZMDataModel.zmLog ("Stopping network pull..."); // make sure this is applied in scope digest to stop network pull - // cant do window stop here as we are about to transition states - // and that causes problems + // thats why we are doing it beforeLeave + + window.stop(); + /* $timeout ( function() { for (var i=0; i< $scope.MontageMonitors.length; i++) @@ -1156,7 +1158,7 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc $scope.MontageMonitors[i].eventUrl = ""; } - },0); + },0);*/ }); $scope.$on('$ionicView.unloaded', function () { -- cgit v1.2.3