This repository was archived by the owner on Oct 8, 2021. It is now read-only.
This repository was archived by the owner on Oct 8, 2021. It is now read-only.
feature request: changePage return value #3409
Closed
Description
example:
changedpage = $.mobile.changePage upload_path
currently, returns undefined. I propose that it should return true or false, depending on whether the page was indeed changed, or no change was made due to the requested page being the active page.
This would be convenient triggering events to reinitialize the page in cases where it is already displayed.
Activity
jblas commentedon Jan 10, 2012
@pehrlich
Calling changePage() can result in an asynchronous request to load an external page, in which case we can't give the caller a definitive answer. We currently fire off pagebeforechange and pagechange events which you can read about here:
http://jquerymobile.com/test/docs/api/events.html
I remember thinking we should return a deferred promise object, but there was a complicating factor that isn't coming to mind at this second. In either case the changePage() might be asynchronous.
pehrlich commentedon Jan 11, 2012
Hmm. If you do remember the complications, I'd love to learn more about the issue. I wouldn't mind attempting to write a patch that would return either false/undefined or a deferred object, as a way to get to learn the source a little better.
Just to give an idea of the code I'd wish to simplify, here's the snippet:
Note that I've circumvented the normal event path-- both because I don't have an event object to send as an argument, and because I'm experimenting with enforcing simpler ways of handling voluminous page events.
toddparker commentedon Feb 13, 2012
Thanks, please add a link to this to the feature request wiki page here on github. We'll re-open when we decide to work on this in a milestone.
https://github.com/jquery/jquery-mobile/wiki/Feature-Requests