Remove caching of main animated pages element
This commit is contained in:
parent
1ade31d499
commit
08ad8e56e1
1 changed files with 11 additions and 11 deletions
|
@ -3,11 +3,7 @@ import './viewManager/viewContainer.scss';
|
||||||
import Dashboard from '../utils/dashboard';
|
import Dashboard from '../utils/dashboard';
|
||||||
|
|
||||||
const getMainAnimatedPages = () => {
|
const getMainAnimatedPages = () => {
|
||||||
if (!mainAnimatedPages) {
|
return document.querySelector('.mainAnimatedPages');
|
||||||
mainAnimatedPages = document.querySelector('.mainAnimatedPages');
|
|
||||||
}
|
|
||||||
|
|
||||||
return mainAnimatedPages;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function setControllerClass(view, options) {
|
function setControllerClass(view, options) {
|
||||||
|
@ -61,7 +57,9 @@ export function loadView(options) {
|
||||||
|
|
||||||
view.classList.add('mainAnimatedPage');
|
view.classList.add('mainAnimatedPage');
|
||||||
|
|
||||||
if (!getMainAnimatedPages()) {
|
const mainAnimatedPages = getMainAnimatedPages();
|
||||||
|
|
||||||
|
if (!mainAnimatedPages) {
|
||||||
console.warn('[viewContainer] main animated pages element is not present');
|
console.warn('[viewContainer] main animated pages element is not present');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -187,6 +185,7 @@ export function setOnBeforeChange(fn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function tryRestoreView(options) {
|
export function tryRestoreView(options) {
|
||||||
|
console.debug('[viewContainer] tryRestoreView', options);
|
||||||
const url = options.url;
|
const url = options.url;
|
||||||
const index = currentUrls.indexOf(url);
|
const index = currentUrls.indexOf(url);
|
||||||
|
|
||||||
|
@ -232,14 +231,15 @@ function triggerDestroy(view) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reset() {
|
export function reset() {
|
||||||
|
console.debug('[viewContainer] resetting view cache');
|
||||||
allPages = [];
|
allPages = [];
|
||||||
currentUrls = [];
|
currentUrls = [];
|
||||||
|
const mainAnimatedPages = getMainAnimatedPages();
|
||||||
if (mainAnimatedPages) mainAnimatedPages.innerHTML = '';
|
if (mainAnimatedPages) mainAnimatedPages.innerHTML = '';
|
||||||
selectedPageIndex = -1;
|
selectedPageIndex = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
let onBeforeChange;
|
let onBeforeChange;
|
||||||
let mainAnimatedPages;
|
|
||||||
let allPages = [];
|
let allPages = [];
|
||||||
let currentUrls = [];
|
let currentUrls = [];
|
||||||
const pageContainerCount = 3;
|
const pageContainerCount = 3;
|
||||||
|
@ -248,8 +248,8 @@ reset();
|
||||||
getMainAnimatedPages()?.classList.remove('hide');
|
getMainAnimatedPages()?.classList.remove('hide');
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
loadView: loadView,
|
loadView,
|
||||||
tryRestoreView: tryRestoreView,
|
tryRestoreView,
|
||||||
reset: reset,
|
reset,
|
||||||
setOnBeforeChange: setOnBeforeChange
|
setOnBeforeChange
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue