From 5911f163e93a49e402bd2495587570f69cbbeb2e Mon Sep 17 00:00:00 2001 From: Andrew Trice Date: Wed, 11 Apr 2012 11:58:33 -0400 Subject: [PATCH] various minor changes --- src/viewnavigator/viewnavigator.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/viewnavigator/viewnavigator.js b/src/viewnavigator/viewnavigator.js index c031197..2f0cef0 100644 --- a/src/viewnavigator/viewnavigator.js +++ b/src/viewnavigator/viewnavigator.js @@ -69,18 +69,21 @@ ViewNavigator.prototype.pushView = function( viewDescriptor ) { ViewNavigator.prototype.popView = function() { - if (this.animating || this.history.length <= 1 ) - return; - - var currentViewDescriptor = this.history[ this.history.length-1]; - if ( currentViewDescriptor.backCallback ) { - currentViewDescriptor.backCallback(); - } + if ( this.history.length > 1 ) { + if (this.animating || this.history.length <= 1 ) + return; - this.history.pop(); - var viewDescriptor = this.history[ this.history.length-1 ]; - viewDescriptor.animation = "popEffect" - this.updateView( viewDescriptor ); + var currentViewDescriptor = this.history[ this.history.length-1]; + this.history.pop(); + + if ( currentViewDescriptor.backCallback ) { + currentViewDescriptor.backCallback(); + } + + var viewDescriptor = this.history[ this.history.length-1 ]; + viewDescriptor.animation = "popEffect" + this.updateView( viewDescriptor ); + } } ViewNavigator.prototype.setHeaderPadding = function( amount ) {