Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
create transition handler object
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbender committed Mar 27, 2013
1 parent e900d62 commit 93b0b48
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
12 changes: 6 additions & 6 deletions js/jquery.mobile.navigation.js
Expand Up @@ -272,7 +272,7 @@ define( [
//isn't one in our transitionHandlers dictionary, use the default one.
//call the handler immediately to kick-off the transition.
var th = $.mobile.transitionHandlers[ transition || "default" ] || $.mobile.defaultTransitionHandler,
promise = th( transition, reverse, toPage, fromPage );
promise = th.transition( transition, reverse, toPage, fromPage );

promise.done(function() {
//trigger show/hide events
Expand All @@ -296,7 +296,7 @@ define( [
aPageBorderB = parseFloat( aPage.css( "border-bottom-width" ) );

height = ( typeof height === "number" )? height : getScreenHeight();

aPage.css( "min-height", height - aPagePadT - aPagePadB - aPageBorderT - aPageBorderB );
};

Expand Down Expand Up @@ -430,7 +430,7 @@ define( [
.jqmData( "url", dataUrl );
}


// If we failed to find a page in the DOM, check the URL to see if it
// refers to the first page in the application. If it isn't a reference
// to the first page and refers to non-existent embedded page, error out.
Expand All @@ -452,7 +452,7 @@ define( [
return deferred.promise();
}
}

// If the page we are interested in is already in the DOM,
// and the caller did not indicate that we should force a
// reload of the file, we are done. Otherwise, track the
Expand All @@ -461,7 +461,7 @@ define( [
if ( !settings.reloadPage ) {
enhancePage( page, settings.role );
deferred.resolve( absUrl, options, page );
//if we are reloading the page make sure we update the base if its not a prefetch
//if we are reloading the page make sure we update the base if its not a prefetch
if( base && !options.prefetch ){
base.set(url);
}
Expand Down Expand Up @@ -499,7 +499,7 @@ define( [
};
}
// Reset base to the default document base.
// only reset if we are not prefetching
// only reset if we are not prefetching
if ( base && typeof options.prefetch === "undefined" ) {
base.reset();
}
Expand Down
31 changes: 18 additions & 13 deletions js/jquery.mobile.transition.js
Expand Up @@ -9,14 +9,18 @@ define( [ "jquery", "./jquery.mobile.core" ], function( jQuery ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, window, undefined ) {

var createHandler = function( sequential ) {

// Default to sequential
if ( sequential === undefined ) {
sequential = true;
}
$.mobile.TransitionHandler = function( sequential ) {
// Default to sequential
if ( sequential === undefined ) {
sequential = true;
}

this.sequential = sequential;
};

return function( name, reverse, $to, $from ) {
$.mobile.TransitionHandler.prototype.transition = function( name, reverse, $to, $from ) {
// TODO temporary
var self = this;

var deferred = new $.Deferred(),
reverseClass = reverse ? " reverse" : "",
Expand Down Expand Up @@ -48,7 +52,7 @@ var createHandler = function( sequential ) {
},
startOut = function() {
// if it's not sequential, call the doneOut transition to start the TO page animating in simultaneously
if ( !sequential ) {
if ( !self.sequential ) {
doneOut();
}
else {
Expand All @@ -64,7 +68,7 @@ var createHandler = function( sequential ) {

doneOut = function() {

if ( $from && sequential ) {
if ( $from && self.sequential ) {
cleanFrom();
}

Expand Down Expand Up @@ -105,7 +109,7 @@ var createHandler = function( sequential ) {

doneIn = function() {

if ( !sequential ) {
if ( !self.sequential ) {

if ( $from ) {
cleanFrom();
Expand Down Expand Up @@ -138,11 +142,12 @@ var createHandler = function( sequential ) {

return deferred.promise();
};
};



// generate the handlers from the above
var sequentialHandler = createHandler(),
simultaneousHandler = createHandler( false ),
var sequentialHandler = new $.mobile.TransitionHandler(),
simultaneousHandler = new $.mobile.TransitionHandler( false ),
defaultGetMaxScrollForTransition = function() {
return $.mobile.getScreenHeight() * 3;
};
Expand Down

0 comments on commit 93b0b48

Please sign in to comment.