Changed pager spinner to be smoother
This commit is contained in:
parent
abc3259222
commit
f2b5124d54
1 changed files with 10 additions and 11 deletions
|
@ -18,22 +18,21 @@ App.PresenterManager = function(jQuery, promise, topNavigationPresenter, keyboar
|
||||||
}
|
}
|
||||||
|
|
||||||
function showContentSpinner() {
|
function showContentSpinner() {
|
||||||
$spinner.show();
|
if (spinnerTimeout !== null) {
|
||||||
|
spinnerTimeout = window.setTimeout(function() {
|
||||||
|
$spinner.show();
|
||||||
|
}, 150);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideContentSpinner() {
|
function hideContentSpinner() {
|
||||||
|
window.clearTimeout(spinnerTimeout);
|
||||||
|
spinnerTimeout = null;
|
||||||
$spinner.hide();
|
$spinner.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
function switchContentPresenter(presenter, args) {
|
function switchContentPresenter(presenter, args) {
|
||||||
var contentPresenterLoaded = function() {
|
showContentSpinner();
|
||||||
window.clearTimeout(spinnerTimeout);
|
|
||||||
hideContentSpinner();
|
|
||||||
};
|
|
||||||
|
|
||||||
spinnerTimeout = window.setTimeout(function() {
|
|
||||||
showContentSpinner();
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
if (lastContentPresenter === null || lastContentPresenter.name !== presenter.name) {
|
if (lastContentPresenter === null || lastContentPresenter.name !== presenter.name) {
|
||||||
if (lastContentPresenter !== null && lastContentPresenter.deinit) {
|
if (lastContentPresenter !== null && lastContentPresenter.deinit) {
|
||||||
|
@ -42,10 +41,10 @@ App.PresenterManager = function(jQuery, promise, topNavigationPresenter, keyboar
|
||||||
keyboard.reset();
|
keyboard.reset();
|
||||||
topNavigationPresenter.changeTitle(null);
|
topNavigationPresenter.changeTitle(null);
|
||||||
topNavigationPresenter.focus();
|
topNavigationPresenter.focus();
|
||||||
presenter.init.call(presenter, args, contentPresenterLoaded);
|
presenter.init.call(presenter, args, hideContentSpinner);
|
||||||
lastContentPresenter = presenter;
|
lastContentPresenter = presenter;
|
||||||
} else if (lastContentPresenter.reinit) {
|
} else if (lastContentPresenter.reinit) {
|
||||||
lastContentPresenter.reinit.call(lastContentPresenter, args, contentPresenterLoaded);
|
lastContentPresenter.reinit.call(lastContentPresenter, args, hideContentSpinner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue