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.
Deprecate $.mobile.loading and move loader creation/showing/hiding into an extension of pagecontainer #6479
Open
Description
-
Deprecate
$.mobile.loading
, and re-implement it like this:$.mobile.loading = function() { var loader, returnValue; // Make sure the pagecontainer widget is present and also // that its loader extension is present if ( $.mobile.pagecontainer && $.mobile.pagecontainer.prototype.loader ) { loader = $.mobile.pageContainer.pagecontainer( "loader" ); returnValue = loader.loader.apply( loader, arguments ); } return returnValue; };
-
Remove
_getLoader()
from pagecontainer, and redefine_showLoading
,_showError
, and_hideLoading
as$.noop
. -
Create a pagecontainer extension that basically moves
_showLoading
,_showError
, and_hideLoading
from the main widget and implements theloader
public API:$.widget( "mobile.pagecontainer", $.mobile.pagecontainer, { options: { showErrorDelay: 1500, }, _loader: null, loader: function() { if ( this._loader == null ) { this._loader = $( $.mobile.loader.prototype.defaultHtml ).loader(); } return this._loader; }, _showLoading: function( delay, theme, msg, textonly ) { // This configurable timeout allows cached pages a brief // delay to load without showing a message this._loadMsg = setTimeout($.proxy(function() { this.loader().loader( "show", theme, msg, textonly ); }, this), delay ); }, _hideLoading: function() { // Stop message show timer clearTimeout( this._loadMsg ); // Hide loading message this.loader().loader( "hide" ); }, _showError: function() { // make sure to remove the current loading message this._hideLoading(); // show the error message - TODO: Move these two globals into loader options this._showLoading( 0, $.mobile.pageLoadErrorMessageTheme, $.mobile.pageLoadErrorMessage, true ); // hide the error message after a delay setTimeout( $.proxy(this, "_hideLoading"), this.options.showErrorDelay ); } });
-
Deprecate
$.mobile.pageLoadErrorMessageTheme
and$.mobile.pageLoadErrorMessage
and move them into loader options and introduce loader public API that shows error. Call it showError() or error(). This latter part is optional and we can wait one more version.