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

Nav thoughts

gabrielschulhof edited this page Jan 20, 2013 · 4 revisions

Do you think we can modify the $.mobile.navigate method to take its parameters as hash? Like, ( url, data, {/* options */} ), or ( { url: url, data: data, otherOption: otherOption, ... } )

The reason I ask is that I'm thinking that we could move a lot of the URL calculation into $.mobile.navigate and have it all in one place. Like: ( url, data, { allowDeepLink: true/false } ), and $.mobile.navigate would also take into account $.mobile.hashListeningEnabled, $.mobile.changePage.defaults.changeHash, etc ...

For example we could move a lot of the url calculation code out of changePage and popup and dialog into this method, and we could make the parameters more flexible (which actually calls for having only one parameter - a hash): { back: true/false (false means forward), url: url, data: data } where the presence of the key "back" means we don't bother checking the url, but instead we either simply call $.mobile.back() or we do the history-disabled version of back, namely what dialog and popup currently do when history is disabled.

I think our ultimate goal should be to have our elements call this method in one of four ways:

  1. URL + deepLink
  2. [ URL + ]noDeepLink (url is optional if you just wanna add a dialogHashKey to the current URL, however, if you're loading a dialog via AJAX, it's not optional)
  3. Back
  4. Forward

Then, we can concentrate our navigation-when-history-is-disabled, stale-dialogHashKey-reuse, initial-url-has-dialogHashKey-corner-case and whatever else into this one place.

Clone this wiki locally