From b38ba3d6ffeb3d8d46c1a56739ba100332a7129e Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Mon, 18 Nov 2013 09:35:57 -0600 Subject: [PATCH] Don't throttle push or pop function, only the UI interaction --- dist/js/ionic-angular.js | 34 +++++++++++++++--------- js/ext/angular/src/directive/ionicNav.js | 34 +++++++++++++++--------- 2 files changed, 42 insertions(+), 26 deletions(-) diff --git a/dist/js/ionic-angular.js b/dist/js/ionic-angular.js index 102e881702..75a4fdae1e 100644 --- a/dist/js/ionic-angular.js +++ b/dist/js/ionic-angular.js @@ -23925,7 +23925,7 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges * Push a template onto the navigation stack. * @param {string} templateUrl the URL of the template to load. */ - this.pushFromTemplate = ionic.throttle(function(templateUrl) { + this.pushFromTemplate = function(templateUrl) { var childScope = $scope.$new(); var last = _this.getTopController(); @@ -23960,12 +23960,10 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges }); }); - }, 300, { - trailing: false - }); + }; - // Pop function, throttled - this.popController = ionic.throttle(function() { + // Pop function + this.popController = function() { var last = _this.pop(); var next = _this.getTopController(); @@ -23987,9 +23985,7 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges } $scope.$parent.$broadcast('navigation.pop'); - }, 300, { - trailing: false - }); + }; // Extend the low-level navigation controller @@ -24181,18 +24177,24 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges } }]) +/** + * Tell the nav controller in the current scope to push a new + * controller onto the stack, with the given template URL. + */ .directive('navPush', function() { return { restrict: 'A', link: function($scope, $element, $attr) { var templateUrl = $attr.navPush; - var pushTemplate = function(e) { + var pushTemplate = ionic.throttle(function(e) { $scope.$apply(function() { $scope.navController && $scope.navController.pushFromTemplate(templateUrl); }); return false; - }; + }, 300, { + trailing: false + }); $element.bind('tap', pushTemplate); @@ -24203,16 +24205,22 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges } }) +/** + * Tell the nav controller in the current scope to pop the top controller + * and go back in the stack. + */ .directive('navPop', function() { return { restrict: 'A', link: function($scope, $element, $attr, navCtrl) { - var popTemplate = function(e) { + var popTemplate = ionic.throttle(function(e) { $scope.$apply(function() { $scope.navController && navController.pop(); }); return false; - }; + }, 300, { + trailing: false + }); $element.bind('tap', popTemplate); diff --git a/js/ext/angular/src/directive/ionicNav.js b/js/ext/angular/src/directive/ionicNav.js index 503d3fe602..4e65b828c9 100644 --- a/js/ext/angular/src/directive/ionicNav.js +++ b/js/ext/angular/src/directive/ionicNav.js @@ -40,7 +40,7 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges * Push a template onto the navigation stack. * @param {string} templateUrl the URL of the template to load. */ - this.pushFromTemplate = ionic.throttle(function(templateUrl) { + this.pushFromTemplate = function(templateUrl) { var childScope = $scope.$new(); var last = _this.getTopController(); @@ -75,12 +75,10 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges }); }); - }, 300, { - trailing: false - }); + }; - // Pop function, throttled - this.popController = ionic.throttle(function() { + // Pop function + this.popController = function() { var last = _this.pop(); var next = _this.getTopController(); @@ -102,9 +100,7 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges } $scope.$parent.$broadcast('navigation.pop'); - }, 300, { - trailing: false - }); + }; // Extend the low-level navigation controller @@ -296,18 +292,24 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges } }]) +/** + * Tell the nav controller in the current scope to push a new + * controller onto the stack, with the given template URL. + */ .directive('navPush', function() { return { restrict: 'A', link: function($scope, $element, $attr) { var templateUrl = $attr.navPush; - var pushTemplate = function(e) { + var pushTemplate = ionic.throttle(function(e) { $scope.$apply(function() { $scope.navController && $scope.navController.pushFromTemplate(templateUrl); }); return false; - }; + }, 300, { + trailing: false + }); $element.bind('tap', pushTemplate); @@ -318,16 +320,22 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges } }) +/** + * Tell the nav controller in the current scope to pop the top controller + * and go back in the stack. + */ .directive('navPop', function() { return { restrict: 'A', link: function($scope, $element, $attr, navCtrl) { - var popTemplate = function(e) { + var popTemplate = ionic.throttle(function(e) { $scope.$apply(function() { $scope.navController && navController.pop(); }); return false; - }; + }, 300, { + trailing: false + }); $element.bind('tap', popTemplate);