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

Refactor: navigation.js A4.1 extensibility

StevenBlack edited this page May 7, 2011 · 24 revisions

List of triggers fired by jquery.mobile.navigation.js @ A4.1

In function transitionPages() definition:

  • from.data( "page" )._trigger( "beforehide", null, { nextPage: to } ); on L447
  • to.data( "page" )._trigger( "beforeshow", null, { prevPage: from || $( "" ) } ); on L449.
    Notes
  • These two triggers are co-located and occur essentially at the same juncture.
  • It's widely agreed that the beforeshow trigger, implementation-named pagebeforeshow via the widget factory, needs to be moved until the page is, in fact, right before show.

In function pageChangeComplete() definition:

  • from.data( "page" )._trigger( "hide", null, { nextPage: to } ); on L482
  • to.data( "page" )._trigger( "show", null, { prevPage: from || $( "" ) } ); on L485.

Notes

  • These two triggers are co-located and occur essentially at the same juncture.

List of clear junctures in jquery.mobile.navigation.js @ A4.1

These locations are good candidates for extensibility hooks because they are at critical junctures hence likely effective, as well as being at predictable junctures hence usable by developers who aren't jQuery Mobile ninjas.

  • At the very top of changePage() to allow for situation specific overrides or pre-empting. For example,

    • overriding the current constraint on navigating to the same url, or
    • forcing a user gesture-consistent transition.
    • Setup and state-setting tasks we're already doing at the top of changePage(), like the call to defaultTransition()
  • At the very bottom of enhancePage(), after the call to the page plugin, to allow for injection of further custom markup by plugins or by developers.

Clone this wiki locally