Skip to content
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
@pehrlich

Description

@pehrlich

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

jblas commented on Jan 10, 2012

@jblas
Contributor

@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

pehrlich commented on Jan 11, 2012

@pehrlich
Author

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:

if $.mobile.activePage.attr('id') == 'edit_upload_page'
    window.pageshow['edit_upload']()
  else
    $.mobile.changePage upload_path

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

toddparker commented on Feb 13, 2012

@toddparker
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @toddparker@jblas@pehrlich

        Issue actions

          feature request: changePage return value · Issue #3409 · jquery-archive/jquery-mobile