-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Refactor: Ajax callback breakout
-
The jQuery Mobile
$.ajax()
call lives injquery.mobile.navigation.js
within a function named$.mobile.loadPage
. -
The
success
anderror
callbacks are defined inline within the$.ajax()
call itself. -
The notion is breaking-out these callbacks would greatly improve jQuery Mobile extensibility by making the callbacks accessible.
In order to split-out the success
callback we'd need to address the following issues:
-
Reference to memvar
fileUrl
which is defined in the$.mobile.loadPage
closure.fileurl
is moreover dependent on memvarabsUrl
which depends on$.mobile.loadPage
parameterurl
. -
Reference to memvar
base
which is defined in the$.mobile.loadPage
closure. -
Reference to memvar
page
which is defined in the$.mobile.loadPage
closure. Memvarpage
is derived from memvarsettings
which is the result of the options passed-in to$.mobile.loadPage
via$.extend( {}, $.mobile.loadPage.defaults, options )
-
Reference to memvar
deferred
defined in the$.mobile.loadPage
closure. -
more (?)
In order to split-out the error
callback we'd need to address the following issues:
-
Reference to memvar
base
which is defined in the$.mobile.loadPage
closure. -
Reference to memvar
deferred
defined in the$.mobile.loadPage
closure.