Couple of modifications to changePage():

- Moved the setting of isPageTransitioning *AFTER* the beforechangepage notification.

- Modified the trigger("beforechangepage") call to pass the args to changePage() as an object since trigger only expects one data arg.
This commit is contained in:
Kin Blas 2011-09-06 16:56:20 -07:00
parent 522b48ee84
commit 701b381cc4

View file

@ -826,12 +826,6 @@
return;
}
// Set the isPageTransitioning flag to prevent any requests from
// entering this method while we are in the midst of loading a page
// or transitioning.
isPageTransitioning = true;
var settings = $.extend( {}, $.mobile.changePage.defaults, options );
// Make sure we have a pageContainer to work with.
@ -842,14 +836,19 @@
url = toPage;
// Let listeners know we're about to change the current page.
mpc.trigger( bcpEvent, url, settings );
mpc.trigger( bcpEvent, { url: url, settings: settings } );
// If the default behavior is prevented, stop here!
if( bcpEvent.isDefaultPrevented() ){
return;
}
// Set the isPageTransitioning flag to prevent any requests from
// entering this method while we are in the midst of loading a page
// or transitioning.
isPageTransitioning = true;
// If the caller passed us a url, call loadPage()
// to make sure it is loaded into the DOM. We'll listen
// to the promise object it returns so we know when