This repository was archived by the owner on Oct 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Refactor: navigation.js A4.1 extensibility
StevenBlack edited this page May 7, 2011
·
24 revisions
-
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-namedpagebeforeshow
via the widget factory, needs to be moved until the page is, in fact, right before show.
-
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.
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 todefaultTransition()
-
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.