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

Commit 93b0b48

Browse files
committed
create transition handler object
1 parent e900d62 commit 93b0b48

File tree

2 files changed

+24
-19
lines changed

2 files changed

+24
-19
lines changed

js/jquery.mobile.navigation.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ define( [
272272
//isn't one in our transitionHandlers dictionary, use the default one.
273273
//call the handler immediately to kick-off the transition.
274274
var th = $.mobile.transitionHandlers[ transition || "default" ] || $.mobile.defaultTransitionHandler,
275-
promise = th( transition, reverse, toPage, fromPage );
275+
promise = th.transition( transition, reverse, toPage, fromPage );
276276

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

298298
height = ( typeof height === "number" )? height : getScreenHeight();
299-
299+
300300
aPage.css( "min-height", height - aPagePadT - aPagePadB - aPageBorderT - aPageBorderB );
301301
};
302302

@@ -430,7 +430,7 @@ define( [
430430
.jqmData( "url", dataUrl );
431431
}
432432

433-
433+
434434
// If we failed to find a page in the DOM, check the URL to see if it
435435
// refers to the first page in the application. If it isn't a reference
436436
// to the first page and refers to non-existent embedded page, error out.
@@ -452,7 +452,7 @@ define( [
452452
return deferred.promise();
453453
}
454454
}
455-
455+
456456
// If the page we are interested in is already in the DOM,
457457
// and the caller did not indicate that we should force a
458458
// reload of the file, we are done. Otherwise, track the
@@ -461,7 +461,7 @@ define( [
461461
if ( !settings.reloadPage ) {
462462
enhancePage( page, settings.role );
463463
deferred.resolve( absUrl, options, page );
464-
//if we are reloading the page make sure we update the base if its not a prefetch
464+
//if we are reloading the page make sure we update the base if its not a prefetch
465465
if( base && !options.prefetch ){
466466
base.set(url);
467467
}
@@ -499,7 +499,7 @@ define( [
499499
};
500500
}
501501
// Reset base to the default document base.
502-
// only reset if we are not prefetching
502+
// only reset if we are not prefetching
503503
if ( base && typeof options.prefetch === "undefined" ) {
504504
base.reset();
505505
}

js/jquery.mobile.transition.js

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@ define( [ "jquery", "./jquery.mobile.core" ], function( jQuery ) {
99
//>>excludeEnd("jqmBuildExclude");
1010
(function( $, window, undefined ) {
1111

12-
var createHandler = function( sequential ) {
13-
14-
// Default to sequential
15-
if ( sequential === undefined ) {
16-
sequential = true;
17-
}
12+
$.mobile.TransitionHandler = function( sequential ) {
13+
// Default to sequential
14+
if ( sequential === undefined ) {
15+
sequential = true;
16+
}
17+
18+
this.sequential = sequential;
19+
};
1820

19-
return function( name, reverse, $to, $from ) {
21+
$.mobile.TransitionHandler.prototype.transition = function( name, reverse, $to, $from ) {
22+
// TODO temporary
23+
var self = this;
2024

2125
var deferred = new $.Deferred(),
2226
reverseClass = reverse ? " reverse" : "",
@@ -48,7 +52,7 @@ var createHandler = function( sequential ) {
4852
},
4953
startOut = function() {
5054
// if it's not sequential, call the doneOut transition to start the TO page animating in simultaneously
51-
if ( !sequential ) {
55+
if ( !self.sequential ) {
5256
doneOut();
5357
}
5458
else {
@@ -64,7 +68,7 @@ var createHandler = function( sequential ) {
6468

6569
doneOut = function() {
6670

67-
if ( $from && sequential ) {
71+
if ( $from && self.sequential ) {
6872
cleanFrom();
6973
}
7074

@@ -105,7 +109,7 @@ var createHandler = function( sequential ) {
105109

106110
doneIn = function() {
107111

108-
if ( !sequential ) {
112+
if ( !self.sequential ) {
109113

110114
if ( $from ) {
111115
cleanFrom();
@@ -138,11 +142,12 @@ var createHandler = function( sequential ) {
138142

139143
return deferred.promise();
140144
};
141-
};
145+
146+
142147

143148
// generate the handlers from the above
144-
var sequentialHandler = createHandler(),
145-
simultaneousHandler = createHandler( false ),
149+
var sequentialHandler = new $.mobile.TransitionHandler(),
150+
simultaneousHandler = new $.mobile.TransitionHandler( false ),
146151
defaultGetMaxScrollForTransition = function() {
147152
return $.mobile.getScreenHeight() * 3;
148153
};

0 commit comments

Comments
 (0)